You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] the restart command ignores the depends_on constraint #12477
I need the dependent service to be restarted after my service
This is exactly what restart is about
Please provide an illustration example. Reporting issue with a single sentence and none of the requested information won't bring you the best assistance we can offer
I need the dependent service to be restarted after my service
This is exactly what restart is about
Please provide an illustration example. Reporting issue with a single sentence and none of the requested information won't bring you the best assistance we can offer
Even I am facing the same issue. While 'systemctl restart docker' its restarting all the containers simultaneously but not considering depends_on and not spinning up the containers in a proper order. Is this issue fixed ? Please let me know.
Even I am facing the same issue. While 'systemctl restart docker' its restarting all the containers simultaneously but not considering depends_on and not spinning up the containers in a proper order. Is this issue fixed ? Please let me know.
@PrawinPracashsystemctl restart docker is unrelated to docker compose. This restarts docker daemon, so all container will be restarted at once. depends_on is a compose-only feature, that only applies to docker compose .. commands, engine isn't aware of such dependencies.
Activity
idsulik commentedon Jan 17, 2025
Please, fill the Steps To Reproduce section
ndeloof commentedon Jan 17, 2025
depends_onis only applied as container is created, until you explicitly declare a dependent service to require being restarted after it's dependency was updated/restarted, see https://docs.docker.com/reference/compose-file/services/#long-syntax-1yangjinheng commentedon Jan 17, 2025
I read this document, but it doesn't solve my problem. restart = true is not what I want.
I need the dependent service to be restarted after my service
Ensure data is saved correctly
yangjinheng commentedon Jan 17, 2025
all containers restart at the same time, and operations with dependencies will fail
ndeloof commentedon Jan 17, 2025
This is exactly what
restartis aboutPlease provide an illustration example. Reporting issue with a single sentence and none of the requested information won't bring you the best assistance we can offer
yangjinheng commentedon Jan 17, 2025
I want prod-quickadmin-1 to restart first, and then prod-mysql-1 to restart
yangjinheng commentedon Jan 17, 2025
The quickadmin service will capture the 15 signal and save some data to mysql
ndeloof commentedon Jan 17, 2025
IIUC you want
quickadminservice to be restart as you restartmysqlservice.Then
restartis what you needyangjinheng commentedon Jan 23, 2025
thanks for reply
i want to support depends_on in
docker compose restartdo not specify a service name
ndeloof commentedon Jan 23, 2025
restartdo supportdepends_on.Please provide a minimal example with the actual behavior and what you expect to be the desired behavior
yangjinheng commentedon Jan 23, 2025
thank you for your patience
look at this code, it is my application
after receiving the signal, it writes some data to the database
main.go
docker-compose.yaml
let's run it
then run
docker-compose down # because of depends_on the data is preservedrun as a comparison
docker-compose restart # data saving failedPrawinPracash commentedon Mar 19, 2025
Even I am facing the same issue. While 'systemctl restart docker' its restarting all the containers simultaneously but not considering depends_on and not spinning up the containers in a proper order. Is this issue fixed ? Please let me know.
yangjinheng commentedon Mar 19, 2025
problem not fixed.
I don't know why it was shut down.
ndeloof commentedon Mar 19, 2025
@PrawinPracash
systemctl restart dockeris unrelated to docker compose. This restarts docker daemon, so all container will be restarted at once.depends_onis a compose-only feature, that only applies todocker compose ..commands, engine isn't aware of such dependencies.