docker / cli

The Docker CLI
Apache License 2.0
4.94k stars 1.93k forks source link

Docker CLI hangs when attempting to detach from container #3385

Open pcgeek86 opened 2 years ago

pcgeek86 commented 2 years ago

Description

On Windows 11, the Docker CLI cannot detach from a container using the CTRL + P, CTRL + Q key sequence.

Steps to reproduce the issue:

  1. Open PowerShell or CMD prompt
  2. docker run --detach --env MYSQL_ROOT_PASSWORD=blah mysql:latest
  3. docker attach <containerId>
  4. Attempt to detach with CTRL + P, CTRL + Q

Describe the results you received:

Docker CLI is "stuck" connected to a container.

Describe the results you expected:

Docker CLI should detach from the container.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Cloud integration: v1.0.20
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:47:53 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:41:30 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.3)
  compose: Docker Compose (Docker Inc., v2.1.1)
  scan: Docker Scan (Docker Inc., 0.9.0)

Server:
 Containers: 6
  Running: 3
  Paused: 0
  Stopped: 3
 Images: 10
 Server Version: 20.10.10
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 5b46e404f6b9f661a205e28d59c982d3634148f8
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.60.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 15.59GiB
 Name: docker-desktop
 ID: LUJQ:6XRO:QAGY:NC7E:DBP2:HH3H:TIA6:Q3TN:U53M:4MH3:PO3R:WI26
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
brandon-leapyear commented 2 years ago

:sparkles: This is an old work account. Please reference @brandonchinn178 for all future communication :sparkles:


Unsure if this is related, but ever since upgrading Docker, running docker compose up ... and then Ctrl+C will stop the container but then hang. Ctrl+C after docker-compose up terminates successfully

Also as a side-note, docker -D compose up doesn't seem to be working. Not sure if that's intended to work

daqqad commented 2 years ago

I'm using Windows Terminal and thought it may be took over the usual ctrl-p, ctrl-q combinations so I tried several others and nothing works. docker attach --detach-keys="ctrl-d" test

Only way to get out is to kill the shell window.

AsharLohmar commented 1 year ago

I have just noticed this behavior while running docker cli from a Ubuntu 18.04 in WSL 1 (Win 10) I'm starting my container on "docker machine" with docker run --rm -it ... I'm starting some applications that have some initial prompts at startup and then should just detach to do their job. With the latest update the key combination seems to do the detaching thing but it does not bring me back to my shell, it just stay there ... the ctr+c doesn't kill neither the application ('cause it's detached most likely) nor the ...whatever process I'm still tied to. My only solution is to either close the terminal window or do a ctrl+z then a bg.

 docker version
Client: Docker Engine - Community
 Version:           23.0.1
 API version:       1.41 (downgraded from 1.42)
 Go version:        go1.19.5
 Git commit:        a5ee5b1
 Built:             Thu Feb  9 19:46:49 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.19.6
  Git commit:       3056208812eb5e792fa99736c9167d1e10f4ab49
  Built:            Wed Feb 15 10:33:28 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.18
  GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640
 runc:
  Version:          1.1.4
  GitCommit:        5fd4c4d144137e991c4acebb2146ab1483a97925
 docker-init:
  Version:          0.19.0
  GitCommit:
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.16.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640
 runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925
 init version:
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.15.95-0-virt
 Operating System: Alpine Linux v3.17
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 480.7MiB
 Name: vpn
 ID: VDB4:FTMT:TKU5:ODAC:IOW4:LJPW:CWVK:WMIQ:5JZD:HSPM:FULX:OHMS
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: asharlohmar
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/go/attack-surface/