Skip to content
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

symlinks not part of build context hash #34260

Closed
justincormack opened this issue Jul 26, 2017 · 0 comments · Fixed by #34271
Closed

symlinks not part of build context hash #34260

justincormack opened this issue Jul 26, 2017 · 0 comments · Fixed by #34271
Labels
area/builder kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. version/17.06

Comments

@justincormack
Copy link
Contributor

justincormack commented Jul 26, 2017

create the following Dockerfile:

FROM alpine AS alpine

RUN touch a
RUN ln -s a /tmp/b
RUN ln -s a /tmp/c

FROM scratch
COPY --from=alpine /bin /bin
COPY --from=alpine /lib /lib
COPY --from=alpine /usr /usr
COPY --from=alpine /tmp /tmp

RUN ls /tmp

build with docker build .
then comment out one ln:

FROM alpine AS alpine

RUN touch a
RUN ln -s a /tmp/b
#RUN ln -s a /tmp/c

FROM scratch
COPY --from=alpine /bin /bin
COPY --from=alpine /lib /lib
COPY --from=alpine /usr /usr
COPY --from=alpine /tmp /tmp

RUN ls /tmp

build again and notice the output is:

Step 1/9 : FROM alpine AS alpine
 ---> 665ffb03bfae
Step 2/9 : RUN touch a
 ---> Using cache
 ---> 0801a30708b5
Step 3/9 : RUN ln -s a /tmp/b
 ---> Using cache
 ---> 1fa1bebaae04
Step 4/9 : FROM scratch
 ---> 
Step 5/9 : COPY --from=alpine /bin /bin
 ---> Using cache
 ---> 524b53bbe62a
Step 6/9 : COPY --from=alpine /lib /lib
 ---> Using cache
 ---> a2f12072d943
Step 7/9 : COPY --from=alpine /usr /usr
 ---> Using cache
 ---> 5d09b665f011
Step 8/9 : COPY --from=alpine /tmp /tmp
 ---> Using cache
 ---> aa9cb5d399d5
Step 9/9 : RUN ls /tmp
 ---> Using cache
 ---> dcbc13560636
Successfully built dcbc13560636

ie it all came from cache, and indeed both symlinks are in the output, when only one is correct (eg if built with no-cache)

Client:
 Version:      17.06.1-ce-rc1
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   77b4dce
 Built:        Fri Jul 14 07:38:15 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.06.1-ce-rc1
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   77b4dce
 Built:        Fri Jul 14 07:33:35 2017
 OS/Arch:      linux/amd64
 Experimental: true
Containers: 155
 Running: 0
 Paused: 0
 Stopped: 155
Images: 989
Server Version: 17.06.1-ce-rc1
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 ipvlan 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: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.38-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: moby
ID: 62QR:HC6P:CL3A:X2OU:VT2R:D4OH:K7PC:W2TG:X6JP:OFZE:PJKA:F2D3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 18
 Goroutines: 30
 System Time: 2017-07-26T14:25:31.789026387Z
 EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

cc @tonistiigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/builder kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. version/17.06
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants