Skip to content
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

Docker API attach doesn't get disconnected when attached to stopped container that is destroyed #41657

Open
sergejostir opened this issue Nov 10, 2020 · 0 comments

Comments

@sergejostir
Copy link

sergejostir commented Nov 10, 2020

Description
Docker API attach endpoint allows us to attach to stopped containers. That is great when you want to ensure that you get all std stream right from when the container is started. However, there is a problem, if you attach to a stopped container that you destroy without starting again.

Steps to reproduce the issue:

  1. Create a container: docker create --name testcontainer alpine:latest
  2. Attach to it: curl -d stream=true -d stdout=true --unix-socket /var/run/docker.sock http://localhost/containers/testcontainer/attach
  3. Remove the container: docker rm testcontainer

Describe the results you received:
The attach stream is kept connected even though the container was removed, so it cannot ever get started.

Describe the results you expected:
I expected the attach stream to get destroyed since the container was removed.

Additional information you deem important (e.g. issue happens only occasionally):
It makes no difference if container had ever ran before.

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:29:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea838
  Built:            Wed Nov 13 07:28:22 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 45
 Server Version: 19.03.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-76-generic
 Operating System: Ubuntu 18.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 985.2MiB
 Name: daemon
 ID: KJ2D:AACS:A5QY:RZWJ:6WTN:MM7B:QQYU:S34F:23F5:O7YV:LBEK:LNMS
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: ******
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):
Virtualbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants