docker / cli

The Docker CLI
Apache License 2.0
4.98k stars 1.94k forks source link

Docker exits with error if STDIN is large and not fully consumed. #1456

Open milescrawford opened 6 years ago

milescrawford commented 6 years ago

Expected behavior

Docker run should exit cleanly regardless of the size of the stream to STDIN.

Actual behavior

When reading only a part of STDIN, if the remaining stream is large, docker has an error and exits with a failure code.

Steps to reproduce the behavior

Here is an example dockerfile and commands to reproduce:

milesc@torre 0 tmp-docker ↠ cat Dockerfile 
FROM library/ubuntu:16.04
ENTRYPOINT ["head", "-n", "1"]

milesc@torre 0 tmp-docker ↠ cat bigfile | docker run -i example && echo "sucesss"
paperid paper_title publisher   doi field   pdf_processed   viewable    users_28days    users_7days frac_users_28days   frac_users_7days
read unix @->/var/run/docker.sock: read: connection reset by peer

milesc@torre 0 tmp-docker ↠ head bigfile | docker run -i example && echo "sucesss"
paperid paper_title publisher   doi field   pdf_processed   viewable    users_28days    users_7days frac_users_28days   frac_users_7days
sucesss

bigfile is about 10,000 lines of csv. Notice the difference in behavior between "cat" and "head"

Output of docker version:

Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.8.3
 Git commit:   092cba3
 Built:        Thu Oct 12 22:34:44 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   092cba3
 Built:        Thu Oct 12 22:34:44 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 57
 Running: 0
 Paused: 0
 Stopped: 57
Images: 2186
Server Version: 1.13.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 632
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-32-generic
Operating System: Ubuntu 17.10
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.07 GiB
Name: torre
ID: 6NFL:O6V4:ZP6D:WYSE:PW2G:MXWI:GZ6L:BC3E:UAW5:ERXJ:Z2VG:G7SH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

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

milescrawford commented 6 years ago

I did originally submit here: https://github.com/docker/for-linux/issues/245 but got advice to resubmit in this repo.