-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] 'docker compose up --exit-code-from' hangs indefinitely while stopping dependent services #12345
Comments
Couldn't reproduce it
compose.yaml
|
As you get compose stuck this way, could you inspect stuck container Would be interesting also to capture |
@ndeloof sending you more information: [+] Stopping 4/5 0.0s | ✔ Container e2e-89-test-suite-1 Stopped 0.0s It is also interesting that the |
ok, so container exited as expected, and we can see |
We had some issues in containerd where early exits didn't always propagate; wondering if related 🤔 cc @laurazard Let me also try if I can reproduce using v27.4.0-rc.4 |
I did some tries to reproduce with a nightly build of docker desktop (with docker engine 27.4.0-rc.4, but so far didn't manage to. docker compose up --exit-code-from service1
[+] Running 3/0
✔ Synchronized File Shares 0.0s
✔ Container early_exit-service2-1 Created 0.0s
✔ Container early_exit-service1-1 Created 0.0s
Attaching to service1-1, service2-1
service1-1 | Exiting immediately
service1-1 exited with code 2
Aborting on container exit...
[+] Stopping 2/2 Desktop o View Config w Enable Watch
✔ Container early_exit-service1-1 Stopped 0.0s
✔ Container early_exit-service2-1 Stopped 10.1s There is a 10-second delay, which is quite likely a timeout because the container not handling time="2024-12-06T11:09:44.670107555Z" level=debug msg="Calling POST /v1.47/containers/3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7/stop" spanID=6ee74b43a6b0c3bf traceID=28de5260372a4b380ec54be139f4bd07
time="2024-12-06T11:09:44.670156430Z" level=debug msg="Sending kill signal 15 to container 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7"
time="2024-12-06T11:09:44.671140722Z" level=debug msg="Calling POST /v1.47/containers/68898b03ce5caf948ae83e479e28fe5ca7c7dc9029e406aaf9b3ea1ec69a6176/stop" spanID=edf610696796a493 traceID=28de5260372a4b380ec54be139f4bd07
time="2024-12-06T11:09:44.676181472Z" level=debug msg="Calling GET /v1.47/containers/3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7/json" spanID=d446c2b4f9104d6e traceID=28de5260372a4b380ec54be139f4bd07
...
time="2024-12-06T11:09:54.681904629Z" level=info msg="Container failed to exit within 10s of signal 15 - using the force" container=3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 spanID=6ee74b43a6b0c3bf traceID=28de5260372a4b380ec54be139f4bd07
time="2024-12-06T11:09:54.682092212Z" level=debug msg="Sending kill signal 9 to container 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7"
time="2024-12-06T11:09:54.698862504Z" level=debug msg=event module=libcontainerd namespace=moby topic=/tasks/exit
time="2024-12-06T11:09:54.699930671Z" level=debug msg="Calling GET /v1.47/containers/3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7/json" spanID=3df7154bc6076d97 traceID=28de5260372a4b380ec54be139f4bd07
time="2024-12-06T11:09:54.705952796Z" level=debug msg=event module=libcontainerd namespace=moby topic=/tasks/delete
time="2024-12-06T11:09:54.705990379Z" level=info msg="ignoring event" container=3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
... Docker Events: 2024-12-06T11:57:00.117973715+01:00 container attach 68898b03ce5caf948ae83e479e28fe5ca7c7dc9029e406aaf9b3ea1ec69a6176 (com.docker.compose.config-hash=022d877be7fc30bb03761e3ff0d4785adfd56b7f5992fde687fd45f6020d5ab1, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service1, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service1-1)
2024-12-06T11:57:00.120627923+01:00 container attach 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 (com.docker.compose.config-hash=6a73f30355f9ed48f7c60f9115f28eda27b6192fa7638d04122f3df93ffe3059, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service2, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service2-1)
2024-12-06T11:57:00.147858798+01:00 network connect 25e2c694d417ddd48eee2c30ac1b82208078c8d8eae4c9fe5efeae8e9d2462b5 (container=3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7, name=early_exit_default, type=bridge)
2024-12-06T11:57:00.149427465+01:00 network connect 25e2c694d417ddd48eee2c30ac1b82208078c8d8eae4c9fe5efeae8e9d2462b5 (container=68898b03ce5caf948ae83e479e28fe5ca7c7dc9029e406aaf9b3ea1ec69a6176, name=early_exit_default, type=bridge)
2024-12-06T11:57:00.286235757+01:00 container start 68898b03ce5caf948ae83e479e28fe5ca7c7dc9029e406aaf9b3ea1ec69a6176 (com.docker.compose.config-hash=022d877be7fc30bb03761e3ff0d4785adfd56b7f5992fde687fd45f6020d5ab1, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service1, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service1-1)
2024-12-06T11:57:00.286654674+01:00 container start 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 (com.docker.compose.config-hash=6a73f30355f9ed48f7c60f9115f28eda27b6192fa7638d04122f3df93ffe3059, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service2, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service2-1)
2024-12-06T11:57:00.361082174+01:00 network disconnect 25e2c694d417ddd48eee2c30ac1b82208078c8d8eae4c9fe5efeae8e9d2462b5 (container=68898b03ce5caf948ae83e479e28fe5ca7c7dc9029e406aaf9b3ea1ec69a6176, name=early_exit_default, type=bridge)
2024-12-06T11:57:00.365547007+01:00 container die 68898b03ce5caf948ae83e479e28fe5ca7c7dc9029e406aaf9b3ea1ec69a6176 (com.docker.compose.config-hash=022d877be7fc30bb03761e3ff0d4785adfd56b7f5992fde687fd45f6020d5ab1, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service1, com.docker.compose.version=2.31.0, execDuration=0, exitCode=2, image=alpine:latest, name=early_exit-service1-1)
2024-12-06T11:57:00.398387090+01:00 container kill 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 (com.docker.compose.config-hash=6a73f30355f9ed48f7c60f9115f28eda27b6192fa7638d04122f3df93ffe3059, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service2, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service2-1, signal=15)
2024-12-06T11:57:10.404813720+01:00 container kill 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 (com.docker.compose.config-hash=6a73f30355f9ed48f7c60f9115f28eda27b6192fa7638d04122f3df93ffe3059, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service2, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service2-1, signal=9)
2024-12-06T11:57:10.481029137+01:00 network disconnect 25e2c694d417ddd48eee2c30ac1b82208078c8d8eae4c9fe5efeae8e9d2462b5 (container=3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7, name=early_exit_default, type=bridge)
2024-12-06T11:57:10.483563553+01:00 container stop 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 (com.docker.compose.config-hash=6a73f30355f9ed48f7c60f9115f28eda27b6192fa7638d04122f3df93ffe3059, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service2, com.docker.compose.version=2.31.0, image=alpine:latest, name=early_exit-service2-1)
2024-12-06T11:57:10.486359803+01:00 container die 3d9fdc5e372b271b9e52704d8b9692003afac8290d397deec7748b59d6d40ed7 (com.docker.compose.config-hash=6a73f30355f9ed48f7c60f9115f28eda27b6192fa7638d04122f3df93ffe3059, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d, com.docker.compose.oneoff=False, com.docker.compose.project=early_exit, com.docker.compose.project.config_files=/Users/thajeztah/Projects/test/early_exit/compose.yaml, com.docker.compose.project.working_dir=/Users/thajeztah/Projects/test/early_exit, com.docker.compose.service=service2, com.docker.compose.version=2.31.0, execDuration=10, exitCode=137, image=alpine:latest, name=early_exit-service2-1) |
Same: was not able to reproduce |
Description
When running
docker compose up --exit-code-from <service1>
, the command hangs indefinitely while stopping a dependent service (e.g., service2). The issue occurs even after service1 exits, preventing the entire docker compose up process from completing.The behavior suggests that Docker Compose struggles to gracefully terminate the dependent service (service2), which may lead to a prolonged or infinite shutdown.
Expected behavior: full compose (with all services) stopped after main service exits. Forcefully kill dependent services if it not responding on time (after 10s)
Actual behaviour: Stopping infinitely waiting for service graceful termination
I tried several solutions, but none of them worked:
stop_signal: SIGKILL
to service2 configurationsstop_grace_period: 10s
to service2 configurationsLogs:
[+] Stopping 4/5 0.0s
| ✔ Container e2e-67-test-suite-1 Stopped 0.0s
| ✔ Container e2e-67-exchange-1 Stopped 10.2s
| ✔ Container e2e-67-stub-collector-1 Stopped 10.2s
| ✔ Container e2e-67-stub-executor-1 Stopped 10.2s
| ⠏ Container e2e-67-agent-1 Stopping 414.9s
Steps To Reproduce
Expected behavior: full compose (with all services) stopped after main service exits. Forcefully kill dependent services if it not responding on time (after 10s)
Actual behaviour: Stopping infinitely waiting for service graceful termination
Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: