--cache-from prevents sharing layers across containers #33002
Open
Description
opened on May 3, 2017
Description
Before 1.10, you could do a docker pull
and then a build with the cache being used so that only changed layers were rebuilt. This is no longer possible since the parent relationships are not maintained by the pull
. Using --cache-from
allows the pulled image to be used by the cache but this prevents sharing layers across containers.
Steps to reproduce the issue:
- Pull
image_a
- Build
image_a
with--cache-from=image_a
- Build
image_b
with--cache-from=image_b
Describe the results you received:
image_b
builds an entirely new image instead of using the layers that should be shared from image_a
.
Describe the results you expected:
Layers that can be shared between image_a
and image_b
are shared.
Output of docker version
:
Docker version 17.03.1-ce, build c6d412e
Output of docker info
:
Containers: 20
Running: 20
Paused: 0
Stopped: 0
Images: 85
Server Version: 17.03.1-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
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.13-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 4.833 GiB
Name: moby
ID: T4IE:7QYK:32DA:MS6V:K6BF:7WBH:GW6Y:VNJK:U65D:XPK5:6KTA:JWD3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 185
Goroutines: 156
System Time: 2017-05-03T20:48:00.005833217Z
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
Activity