Can't send Ctrl-C to terminal to stop Docker container #15309

Closed
opened 2026-01-31 04:34:36 +00:00 by claunia · 5 comments
Owner

Originally created by @hongooi73 on GitHub (Sep 22, 2021).

Windows Terminal version (or Windows build number)

1.10.2383.0, Windows version 10.0.18363.1734

Other Software

Docker version 20.10.8, build 3967b7d

Steps to reproduce

  1. Run a docker container with docker run
  2. Try to stop it by pressing Ctrl-C

My use case was a Jupyter notebook image, but presumably this happens with any image that you run in the foreground.

docker pull jupyter/base-notebook
docker run -p 8888:8888 jupyter/base-notebook

Expected Behavior

It should stop the container

Actual Behavior

The Ctrl-C is ignored, container keeps running

Originally created by @hongooi73 on GitHub (Sep 22, 2021). ### Windows Terminal version (or Windows build number) 1.10.2383.0, Windows version 10.0.18363.1734 ### Other Software Docker version 20.10.8, build 3967b7d ### Steps to reproduce 1. Run a docker container with `docker run` 2. Try to stop it by pressing Ctrl-C My use case was a Jupyter notebook image, but presumably this happens with any image that you run in the foreground. ``` docker pull jupyter/base-notebook docker run -p 8888:8888 jupyter/base-notebook ``` ### Expected Behavior It should stop the container ### Actual Behavior The Ctrl-C is ignored, container keeps running
claunia added the Needs-TriageResolution-ExternalNeeds-Tag-FixNeeds-Attention labels 2026-01-31 04:34:37 +00:00
Author
Owner

@DHowett commented on GitHub (Sep 22, 2021):

Is this Docker for Windows, Docker for WSL 2, or traditional Docker Desktop with the legacy "Docker Container" VM?

Does this happen outside of the Terminal?

@DHowett commented on GitHub (Sep 22, 2021): Is this Docker for Windows, Docker for WSL 2, or traditional Docker Desktop with the legacy "Docker Container" VM? Does this happen outside of the Terminal?
Author
Owner

@hongooi73 commented on GitHub (Sep 22, 2021):

This is Docker for Windows, using WSL2 as the backend.

@hongooi73 commented on GitHub (Sep 22, 2021): This is Docker for Windows, using WSL2 as the backend.
Author
Owner

@DHowett commented on GitHub (Sep 22, 2021):

If you use Docker outside of the Windows Terminal (just using the traditional console), does it still happen?

@DHowett commented on GitHub (Sep 22, 2021): If you use Docker outside of the Windows Terminal (just using the traditional console), does it still happen?
Author
Owner

@hongooi73 commented on GitHub (Sep 22, 2021):

Hm, the same thing happens with cmd.exe, so it must be a problem with docker.

Oddly, pressing Ctrl-C to interrupt docker-compose works....

@hongooi73 commented on GitHub (Sep 22, 2021): Hm, the same thing happens with cmd.exe, so it must be a problem with docker. Oddly, pressing Ctrl-C to interrupt docker-compose works....
Author
Owner

@DHowett commented on GitHub (Sep 22, 2021):

Curious. Given that it happens in the traditional console, I'm going to guess that this is an issue in docker.exe; they may be suppressing the console ^C handler on Windows erroneously when they should only do that for an interactive/tty connection.

It may be worth filing at https://github.com/docker/for-win 😄

@DHowett commented on GitHub (Sep 22, 2021): Curious. Given that it happens in the traditional console, I'm going to guess that this is an issue in `docker.exe`; they may be suppressing the console ^C handler on Windows erroneously when they should only do that for an interactive/tty connection. It may be worth filing at https://github.com/docker/for-win :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15309