Docker compose up then CTRL-C behavior change

I’ve noticed a change in the behavior of using the docker compose up command. When I press CTRL-C now, it stops the containers then waits. What is it waiting for?

image

I have to enter a key twice, then it exits to the prompt.

image

I verified the container exits with 0.

The first time you press ^C, you send the SIGINT signal to gracefully stop the container. By default, that gives the container 10 seconds to shut down

The second time, you send the SIGKILL signal which forcefully stops the container

1 Like

Thanks for that info. I just want to point out that the container successfully exits after 3 seconds. However the Docker waits until I press a key on the keyboard. That is behavior I’ve not seen before.

I wasn’t sure if my answer was correct for your case, as the first screenshot is showing “Stopped” and not “Stopping”, so indeed, you’re experiencing something a tad weird

Which Docker Desktop version and where did you run the command? Powershell or cmd or maybe VSCode terminal?

update:

I could reproduce on Windows in PowerShell and also in cmd. I’m not sure if it has to do something with Windows only or a Docker Desktop bug on Windows. But you don’t have to press CTRL+C again, an enter is enough.

You could report it on GitHub