moby: docker exec does not exit when container process terminates

Description of problem:

docker exec does not exit when the container process terminates. This only happens when running in interactive but no with no tty.

ie:

docker exec -i <container> ps

hangs until Ctrl-C or Enter is pressed. It seems and input from STDIN is necessary for it to check the process state…

it works fine with docker exec -it <container> ps and docker exec <container> ps

This is an issue when using it to run rsync or scp command through an ssh tunnel (key based forced commands). the sync / copy works fine but never exits…

docker version:

Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64

tested on 1.5 too

docker info:

Containers: 6
Images: 100
Storage Driver: devicemapper
 Pool Name: docker-202:81-917511-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file:
 Metadata file:
 Data Space Used: 3.734 GB
 Data Space Total: 107.4 GB
 Data Space Available: 103.6 GB
 Metadata Space Used: 5.931 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.142 GB
 Udev Sync Supported: false
 Library Version: 1.02.82-git (2013-10-04)
Execution Driver: native-0.2
Kernel Version: 3.13.0-44-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 1
Total Memory: 3.676 GiB
Name: docker1
ID: 645K:6725:O2Y7:Q5R4:5COY:353S:PX64:BUYO:6RTN:5YUS:R54G:QCDF
WARNING: No swap limit support

uname -a:

Linux docker1 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Steps to Reproduce:

docker exec -i <container> ps

Actual Results:

process does not exit

Expected Results:

process exits (returns to prompt)

Additional info:

hangs until Ctrl-C or Enter is pressed. It seems and input from STDIN is necessary for it to check the process state…

it works fine with docker exec -it <container> ps and docker exec <container> ps

This is an issue when using it to run rsync or scp command through an ssh tunnel (key based forced commands). the sync / copy works fine but never exits…

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 3
  • Comments: 34 (13 by maintainers)

Most upvoted comments

I got the same issue with Docker-1.8.3 and Ubuntu Trusty

I’m getting this issue again with Docker 1.7.1