In docker-compose, the startup parameters of Container A depend on the running result of Container B. what should I do?

I really don"t know how to describe it

Let"s put it this way, my docker-compose contains two services: container An and container B;
the persistence directory of container A when it starts is the log directory of container B, but the directory is random, that is, container B can only get it through the docker inspect command after startup; it is possible to start container A separately and use the shell script, but I want to start it together in a docker-compose.yml file.

Welcome to the solution! Thank you ~

Oct.01,2021
Can't the log directory of

Container B be persisted? Why random?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b257-2c251.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b257-2c251.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?