-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
area/builderBuildBuildarea/lcowIssues and PR's related to the experimental LCOW featureIssues and PR's related to the experimental LCOW featureplatform/windows
Description
Description
If an image is rebuild with different content but with the same name, builder continues to use the old layers as cache.
Steps to reproduce the issue:
- First Dockerfile:
Second Dockerfile:
FROM alpine RUN echo 1 > /test.txtThird Dockerfile:FROM alpine RUN echo 2 > /test.txtFROM alpine COPY --from=testcachelinux /test.txt /t.txt RUN cat /t.txt - Run the following build commands:
docker build --platform=linux -t testcachelinux 1
docker build --platform=linux -t testusecachelinux 3
docker build --platform=linux -t testcachelinux 2
docker build --platform=linux -t testusecachelinux 3
Describe the results you received:
Outputs:
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM alpine
---> 3fd9065eaf02
Step 2/2 : RUN echo 1 > /test.txt
---> Running in 9d984852bca6
Removing intermediate container 9d984852bca6
---> 886af9e109ed
Successfully built 886af9e109ed
Successfully tagged testcachelinux:latest
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM alpine
---> 3fd9065eaf02
Step 2/3 : COPY --from=testcachelinux /test.txt /t.txt
---> c29dd34dfe6c
Step 3/3 : RUN cat /t.txt
---> Running in 6bdb005480a5
1
Removing intermediate container 6bdb005480a5
---> 226c261ba92d
Successfully built 226c261ba92d
Successfully tagged testusecachelinux:latest
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM alpine
---> 3fd9065eaf02
Step 2/2 : RUN echo 2 > /test.txt
---> Running in cc315eee2de6
Removing intermediate container cc315eee2de6
---> c073b79f83fd
Successfully built c073b79f83fd
Successfully tagged testcachelinux:latest
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM alpine
---> 3fd9065eaf02
Step 2/3 : COPY --from=testcachelinux /test.txt /t.txt
---> Using cache
---> c29dd34dfe6c
Step 3/3 : RUN cat /t.txt
---> Using cache
---> 226c261ba92d
Successfully built 226c261ba92d
Successfully tagged testusecachelinux:latest
Describe the results you expected:
Output of the last command should be:
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM alpine
---> 3fd9065eaf02
Step 2/3 : COPY --from=testcachelinux /test.txt /t.txt
---> SomeOtherId
Step 3/3 : RUN cat /t.txt
---> Running in SomeOtherId
2
Removing intermediate container SomeOtherId
---> SomeOtherId
Successfully built SomeOtherId
Successfully tagged testusecachelinux:latest
Additional information you deem important (e.g. issue happens only occasionally):
This is not an issue for windows containers. If you want to try here are the Dockerfiles and commands:
First Dockerfile:
# escape=`
FROM microsoft/windowsservercore
RUN echo 1 > C:\test.txt
Second Dockerfile:
# escape=`
FROM microsoft/windowsservercore
RUN echo 2 > C:\test.txt
Third Dockerfile:
# escape=`
FROM microsoft/windowsservercore
COPY --from=testcachewindows C:\test.txt C:\t.txt
RUN type C:\t.txt
Commands:
docker build -t testcachewindows 1
docker build -t testusecachewindows 3
docker build -t testcachewindows 2
docker build -t testusecachewindows 3
Outputs:
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM microsoft/windowsservercore
---> 1a599239a62c
Step 2/2 : RUN echo 1 > C:\test.txt
---> Running in 6f3ac59af048
Removing intermediate container 6f3ac59af048
---> d9a87b04fe65
Successfully built d9a87b04fe65
Successfully tagged testcachewindows:latest
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM microsoft/windowsservercore
---> 1a599239a62c
Step 2/3 : COPY --from=testcachewindows C:\test.txt C:\t.txt
---> 28280943f396
Step 3/3 : RUN type C:\t.txt
---> Running in 46ca27f3968d
1
Removing intermediate container 46ca27f3968d
---> cacf919a2ee2
Successfully built cacf919a2ee2
Successfully tagged testusecachewindows:latest
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM microsoft/windowsservercore
---> 1a599239a62c
Step 2/2 : RUN echo 2 > C:\test.txt
---> Running in d25ebc2638b5
Removing intermediate container d25ebc2638b5
---> e6533c599c75
Successfully built e6533c599c75
Successfully tagged testcachewindows:latest
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM microsoft/windowsservercore
---> 1a599239a62c
Step 2/3 : COPY --from=testcachewindows C:\test.txt C:\t.txt
---> 9feb73000076
Step 3/3 : RUN type C:\t.txt
---> Running in b77b405761e4
2
Removing intermediate container b77b405761e4
---> 630e7799bf98
Successfully built 630e7799bf98
Successfully tagged testusecachewindows:latest
Output of docker version:
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:06:28 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.0-ce
API version: 1.37 (minimum version 1.24)
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:21:06 2018
OS/Arch: windows/amd64
Experimental: true
Output of docker info:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 10
Server Version: 18.03.0-ce
Storage Driver: windowsfilter (windows) lcow (linux)
Windows:
LCOW:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd gelf json-file logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 16299 (16299.15.amd64fre.rs3_release.170928-1534)
Operating System: Windows 10 Enterprise
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 15.89GiB
Name: YUSUFG-PC
ID: 7BCW:GTLJ:2FQB:KV3J:NRRE:IHTW:6C3B:YOCE:65GK:NKHJ:IS3D:3LNJ
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 23
System Time: 2018-04-05T16:10:42.9263824+03:00
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/builderBuildBuildarea/lcowIssues and PR's related to the experimental LCOW featureIssues and PR's related to the experimental LCOW featureplatform/windows