docker / docker/cli

`docker container create` has no way to attach no streams

Open
#1,945 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/ux version/18.09
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

docker create appears to ignore --tty=false. No matter what --tty option is provided, AttachStdout and AttachStderr are set to true.

Steps to reproduce the issue:

  1. docker create --tty=false alpine:3.9
  2. docker inspect $(docker ps -a -q | head -1) | grep Attach

Describe the results you received:

            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,

Describe the results you expected:

            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,

Additional information you deem important (e.g. issue happens only occasionally):
This appears to be caused by lines 323-326 of cli/command/container/opts.go which defaults AttachStdout and AttachStderr to true if no -a or --attach option is specified. So it seems there is no way to create a container without attaching at least one stream.

Output of docker version:

$ docker version
Client:
 Version:           18.09.5
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        e8ff056
 Built:             Thu May  9 23:11:19 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.5
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       e8ff056
  Built:            Thu May  9 22:59:19 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 4857
Server Version: 18.09.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 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: 
runc version: N/A
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-50-generic
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 19.49GiB
Name: newt
ID: TXYZ:BBF3:KHVB:3ZYD:TXO6:RCQH:E7HG:HEUP:5F5C:VATF:NFHB:DUP6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
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.):
I can't think of any that are relevant.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cli/command/container/opts.go around lines 323-326 and reproduce the issue with docker create --tty=false alpine:3.9. Inspect the created container's AttachStdin, AttachStdout, and AttachStderr values; done means the stdout and stderr fields remain false when no attach option is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.