Docker Community Forums

Share and learn in the Docker community.

--cache-from seems to behave differently on Mac and Ubuntu


(Ojolanki) #1

On our CI system, the builders get destroyed, and thus lose the cache. I am trying to make use of --cache-from to overcome the task of rebuilding the images from scratch.
My strategy is:
1.Pull image from quay
2.Build new image, using --cache-from with the pulled image.

On macOS High Sierra V 10.13.2
docker info:

Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.0-ce
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: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.60-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: SVEF:IOMR:RXEI:AAHM:OZOG:VU76:XYIX:QYBT:LHD6:PQ4B:OOZT:XKSQ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 22
Goroutines: 41
System Time: 2018-01-30T22:50:14.819689584Z
EventsListeners: 2
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: index(dot)docker(dot)io/v1/ (changed, due to new users not being able to put too many links in posts)
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

When I first run on Mac

docker pull quay.io/encode-dcc/atac-seq-pipeline:develop_test_jenkins
git clone -b develop_test_jenkins https://github.com/ENCODE-DCC/atac-seq-pipeline
cd atac-seq-pipeline
docker build --cache-from=quay(dot)io/encode-dcc/atac-seq-pipeline:develop_test_jenkins -f docker_image/Dockerfile -t quay(dot)io/encode-dcc/atac-seq-pipeline:dev3 .

Everything works, new build uses cache and thus the build is fast whereas on ubuntu box on AWS:

|Distributor ID:|Ubuntu|
|—|---|
|Description:|Ubuntu 16.04.3 LTS|
|Release:|16.04|
|Codename:|xenial|
docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.0-ce
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 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: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-1047-aws
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.858GiB
Name: ip-xxxxxxxxx
ID: UB7H:A5VM:2Y5V:5FVI:MN6Y:YE4E:RDHO:E2DO:IJUV:JLTI:X6LE:JF4V
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: httpsindex(dot)docker(dot)io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support

Building with exactly same commands the first 18 build steps use cache, but then everything after that (Step 19/61 : COPY /docker_image/site.cfg numpy/) gets rebuilt.

This problem is driving me crazy, and the build time is just too much. Does anyone have any ideas, what might cause the caching to break? Thank you.