grammarly/rocker

Defining ENTRYPOINT causes CMD from parent image to be lost

juliohm1978 opened this issue · 2 comments

Environment:

> rocker -v
rocker version 1.3.0 - 9444404 (master) 2016-07-20_13:43_GMT
> rocker info
Docker host: unix:///var/run/docker.sock
Docker use TLS: false
Docker Version: 17.06.0-ce
Docker GitCommit: 02c1d87
Docker Os: linux
Docker KernelVersion: 4.4.0-78-generic
Docker ApiVersion: 1.30
Docker MinAPIVersion: 1.12
Docker GoVersion: go1.8.3
Docker Arch: amd64
Docker BuildTime: 2017-06-23T21:19:04.990631145+00:00
> 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

We have images that build on top of each other. As usual, a base image is used as the parent for others.

Using Rocker, however, we noticed that defining the ENTRYPOINT for a child image will cause the CMD from its parent to be lost. Below is an example.

Rockerfile1

FROM ubuntu
CMD ["/mycmd.sh"]
TAG test1

Rockerfile2

FROM test1
ENTRYPOINT ["/myentry.sh"]
TAG test2

Running the following commands:

rocker build --no-cache -f Rockerfile1
rocker build --no-cache -f Rockerfile2

Now, inspecting the created images, test1 and test2, notice that CMD from test2 is missing.

> docker inspect --format '{{.Config.Cmd}}' test1
[/mycmd.sh]

> docker inspect --format '{{.Config.Cmd}}' test2
[]

The same does not happen using docker build.

NOTE: A few edits were made to the initial text to fix typos and correct scripts to provide a valid/consistent scenario. Nevertheless, the issue is reproducible on different machines for me.

Issue has gone stale for months now. Will gladly reopen if anyone is interested.