The "depends_on" option in Docker Compose allows you to specify the order in which services should be started. However, if you are using "docker run" to start your containers instead, there is no built-in functionality to control start order.
One option you have is to use a shell script that starts the containers in the required order. For example:
#!/bin/bash
docker run -d --name db mydb
docker run -d --name app --link db:db myapp
In this case, the script will start the "db" container first, and then start the "app" container with a link to the "db" container.
Another option is to use a tool like "wait-for-it" to delay the start of a container until another container is ready. For example:
docker run -d --name db mydb
docker run -d --name app \
--entrypoint=./wait-for-it.sh db:3306 -- \
myapp
In this case, the "app" container will not start until the "db" container is listening on port 3306. The "wait-for-it.sh" script is used to block until the database is ready.