In docker-compose, the startup parameter of container A depends on the running result of container B. What should I do?

  docker, question

I really don’t know how to describe it

Let’s say, my docker-compose includes two services: Container A and Container B;
The persistent directory when container A starts is the log directory of container B, but the directory is random, that is, it passes after container B starts.docker inspectOrders can only be obtained;
It is certainly possible to start separately and through shell scripts, but I want to start together in a docker-compose.yml file. .

Welcome to give solutions! Thank you ~ ~

Can’t the log directory of container b be persisted? Why is it random?