for-linux icon indicating copy to clipboard operation
for-linux copied to clipboard

STOPSIGNAL, ENTRYPOINT [] and CMD

Open VolCh opened this issue 8 years ago • 1 comments

  • [x] This is a bug report
  • [ ] This is a feature request
  • [ ] I searched existing issues before opening this one

Expected behavior

With Dockerfile with STOPSIGNAL (maybe some others, but I found only one), ENTRYPOINT [] and CMD directives the Config.Cmd section in the images is always according CMD directive.

Actual behavior

With Dockerfile with STOPSIGNAL (maybe some others, but I found only one), ENTRYPOINT [] (exactly empty) and CMD directives the Config.Cmd section in the images is not according CMD directive after first directive follows CMD.

Steps to reproduce the behavior

Dockerfile (the minimal I found to reproduce)

FROM busybox
STOPSIGNAL SIGQUIT
ENTRYPOINT []
CMD ["true"]
RUN touch /tmp/test
RUN touch /tmp/test

docker build .

Sending build context to Docker daemon  2.048kB
Step 1/6 : FROM busybox
 ---> c30178c5239f
Step 2/6 : STOPSIGNAL SIGQUIT
 ---> Using cache
 ---> c98f9acad3b6
Step 3/6 : ENTRYPOINT
 ---> Using cache
 ---> 585b9f7029a9
Step 4/6 : CMD true
 ---> Using cache
 ---> d762f2baa1a0
Step 5/6 : RUN touch /tmp/test
 ---> Using cache
 ---> e54ace1dd54d
Step 6/6 : RUN touch /tmp/test
 ---> Using cache
 ---> a223bd06973d
Successfully built a223bd06973d

docker inspect --format "{{.Config.Cmd}}" d762f2baa1a0 #Step 4/6 Expected output [true] docker inspect --format "{{.Config.Cmd}}" e54ace1dd54d #Step 5/6 Expected the previous output, got unexpected [/bin/sh -c #(nop) CMD ["true"]] docker inspect --format "{{.Config.Cmd}}" d762f2baa1a0 #Step 6/6 Expected result [true]

If the Dockerfile contains exactly one instruction after CMD the image will be useless, it can't be running without exact command in params/docker-compose.yml

Output of docker version:

Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:23:31 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:19:04 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 114
Server Version: 17.06.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 71
 Dirperm1 Supported: 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 logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-83-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859GiB
Name: deploy
ID: BU2X:SGME:FPYJ:4FG7:BAD6:VFT4:VHSY:LZBC:6TQF:KBR2:NMSL:WTL3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
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.) The same behavior on physical (laptop) & and virtual (VMWare vSphere) hosts.

VolCh avatar Jul 16 '17 09:07 VolCh

This Dockerfile is not enough to reproduce. I'm trying to find minimal enough set from my real 70-lines multi-target Dockerfile

VolCh avatar Jul 16 '17 11:07 VolCh