New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blanking a parent image's ENTRYPOINT busts the child's cache #37643
Comments
I've run into this as well; I believe it was only when mine was set to |
I can reproduce the issue on Ubuntu 18.04.3 and Docker 19.03.2 Simple FROM ubuntu
RUN echo "this gets cached"
ENTRYPOINT ["true"]
RUN echo "this gets cached too"
ENTRYPOINT []
RUN echo "this one doesn't get cached" Output on first build:
Output on 2nd and further builds:
Step 5 & 6 doesn't get cached |
This was rediscovered/reconfirmed in #3465 (comment). 😞 |
$ docker version
Client: Docker Engine - Community
Version: 20.10.0-beta1
API version: 1.41
Go version: go1.13.15
Git commit: ac365d7
Built: Tue Oct 13 18:13:41 2020
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.0-beta1
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 9c15e82
Built: Tue Oct 13 18:17:18 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.1
GitCommit: c623d1b36f09f8ef6536a057bd658b3aa8632828
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
$ cat Dockerfile
FROM bash
ENTRYPOINT []
RUN echo never cached
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM bash
latest: Pulling from library/bash
188c0c94c7c5: Pull complete
94387ca39817: Pull complete
efe7174943e6: Pull complete
Digest: sha256:01fad26fa8ba21bce6e8c47222acfdb54649957f1e86d53a0c8e03360271abf6
Status: Downloaded newer image for bash:latest
---> 39a95ac32011
Step 2/3 : ENTRYPOINT []
---> Running in 849b813584b7
Removing intermediate container 849b813584b7
---> 83780b57402b
Step 3/3 : RUN echo never cached
---> Running in f67165121267
never cached
Removing intermediate container f67165121267
---> 129d3f56aaad
Successfully built 129d3f56aaad
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM bash
---> 39a95ac32011
Step 2/3 : ENTRYPOINT []
---> Running in 893405f7299b
Removing intermediate container 893405f7299b
---> 5e34458be803
Step 3/3 : RUN echo never cached
---> Running in 026c08b3f84e
never cached
Removing intermediate container 026c08b3f84e
---> ceb1d3fed119
Successfully built ceb1d3fed119 |
Yes, was able to reproduce; looks to be only with the classic builder, and not with buildkit; mkdir repro-37643 && cd repro-37643
cat > Dockerfile -<<'EOF'
FROM bash
ENTRYPOINT []
RUN echo never cached
EOF DOCKER_BUILDKIT=0 docker build .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM bash
latest: Pulling from library/bash
188c0c94c7c5: Already exists
94387ca39817: Pull complete
efe7174943e6: Pull complete
Digest: sha256:01fad26fa8ba21bce6e8c47222acfdb54649957f1e86d53a0c8e03360271abf6
Status: Downloaded newer image for bash:latest
---> 39a95ac32011
Step 2/3 : ENTRYPOINT []
---> Running in 0bfdba8a93a9
Removing intermediate container 0bfdba8a93a9
---> 949b6885127b
Step 3/3 : RUN echo never cached
---> Running in b4cff1140a3c
never cached
Removing intermediate container b4cff1140a3c
---> 05b7507d3eda
Successfully built 05b7507d3eda DOCKER_BUILDKIT=0 docker build .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM bash
---> 39a95ac32011
Step 2/3 : ENTRYPOINT []
---> Running in 3f78aa541994
Removing intermediate container 3f78aa541994
---> 0b195faa28c7
Step 3/3 : RUN echo never cached
---> Running in 0d5ddecf31ee
never cached
Removing intermediate container 0d5ddecf31ee
---> 882bf67681da
Successfully built 882bf67681da bash-5.0$ DOCKER_BUILDKIT=1 docker build .
[+] Building 1.1s (6/6) FINISHED
=> [internal] load .dockerignore 0.2s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 88B 0.0s
=> [internal] load metadata for docker.io/library/bash:latest 0.0s
=> [1/2] FROM docker.io/library/bash 0.3s
=> => resolve docker.io/library/bash:latest 0.0s
=> [2/2] RUN echo never cached 0.4s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:a1bb8d52d475aec5a3cc09b2ece0b40a881dac44512fa6b5530c05fe462359c6 0.0s bash-5.0$ DOCKER_BUILDKIT=1 docker build .
[+] Building 0.2s (6/6) FINISHED
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 36B 0.0s
=> [internal] load metadata for docker.io/library/bash:latest 0.0s
=> [1/2] FROM docker.io/library/bash 0.0s
=> CACHED [2/2] RUN echo never cached 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:a1bb8d52d475aec5a3cc09b2ece0b40a881dac44512fa6b5530c05fe462359c6 0.0s |
Description
If a parent docker image defines ENTRYPOINT and a child blanks it out (
ENTRYPOINT []
), that line in the child busts the cache.Steps to reproduce the issue:
Create three Dockerfiles:
Now build the parent:
Describe the results you expected:
Repeatedly building
child.redefined
behaves exactly as expected. Each stage is cached and the final result is identical each timel:00427e0e1d2e
.Describe the results you received:
Repeatedly building
child.empty
shows that the cache busts at theENTRYPOINT
line. As a result, a new image is produced and tagged on every single build.Since the dockerfile has not changed, each stage should be cached and an identical image produced/tagged at the end.
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
This is on a Macbook Pro running High Sierra 10.13.6.
I cannot reproduce the issue on an Ubuntu 16.04 host running 17.05.0-ce server and client.
The text was updated successfully, but these errors were encountered: