New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CTRL+C always stops all running container #9696
Comments
It looks like this is related to For example, consider the following (using example from issue): $ docker compose up -d database
[+] Running 1/1
⠿ Container ctrlc-database-1 Started
$ docker compose up app
[+] Running 2/0
⠿ Container ctrlc-database-1 Running 0.0s
⠿ Container ctrlc-app-1 Created
...
# hit ctrl-c
^CGracefully stopping... (press Ctrl+C again to force)
[+] Running 0/0
⠋ Container ctrlc-app-1 Stopping 0.1s
canceled
$ docker compose ps
docker compose ps
NAME COMMAND SERVICE STATUS PORTS
ctrlc-app-1 "/docker-entrypoint.…" app exited (0)
ctrlc-database-1 "docker-entrypoint.s…" database exited (0) The
The case as described in the original issue is a bit murkier - I'm not sure what the right behavior here is! If you |
This keeps parity with v1, where only the containers explicitly passed to `up` are torn down when `Ctrl-C` is hit, so any dependencies that got launched (or orphan containers hanging around) should not be touched. Fixes docker#9696. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
This keeps parity with v1, where only the containers explicitly passed to `up` are torn down when `Ctrl-C` is hit, so any dependencies that got launched (or orphan containers hanging around) should not be touched. Fixes #9696. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
#9701 includes a fix that will be included in the next Compose release. If you Thanks for the bug report and repro steps! |
This keeps parity with v1, where only the containers explicitly passed to `up` are torn down when `Ctrl-C` is hit, so any dependencies that got launched (or orphan containers hanging around) should not be touched. Fixes docker#9696. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Description
There is a difference in behaviour in CTRL+C between Docker Compose V1 and V2.
I came across the issue #9287 but I think this situation is not the same.
In Docker Compose V1, CTRL+C stops all services if the
up
command is used without specifying any services.If the
up
command is provided with the name of the service(s), it only stops the given service(s).However, in Docker Compose V2, CTRL+C always stops all services regardless if the
up
command is provided with the name of service(s).Given a sample
docker-compose.yml
file.Steps to reproduce the issue:
docker-compose up app
docker compose up app
Describe the results you received:
Both
app
anddatabase
services stopped.Describe the results you expected:
Only the
app
service is stopped.Output of
docker compose version
:Output of
docker info
:Additional environment details:
The text was updated successfully, but these errors were encountered: