moby: Caching not working with docker load in 1.10.0

I’m relying on docker save and docker load to take the advantage of the caching until 1.9.1 but this technique seems not working in 1.10.0. I’m doing this instead of using normal caching because this is on CI where created images and cache do not persist in next build.

Here is how to reproduce.

Dockerfile

$ cat Dockerfile
From busybox
RUN echo 'bbbb'
RUN echo 'ffff'

Create a image

$ docker build -t cache-test .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM busybox
 ---> 3240943c9ea3
Step 2 : RUN echo 'bbbb'
 ---> Running in c56df4a6e3f4
bbbb
 ---> 8e5bb62e1278
Removing intermediate container c56df4a6e3f4
Step 3 : RUN echo 'ffff'
 ---> Running in bf656c2b5385
ffff
 ---> 043911d06ec5
Removing intermediate container bf656c2b5385
Successfully built 043911d06ec5

Save the image to tar file

$ docker save cache-test > /tmp/cache-test.tar

Delete the image

$ docker rmi cache-test
Untagged: cache-test:latest
Deleted: bca6443ae25a399e8922a876df0a87b5b948598000e44e66324c5b40b08b6c04
Deleted: 36585925a99995799b1ba60a5032738f8fa3ea9a13bcc8de54cd3ea13b9e47b4

Load the image

$ docker load -i /tmp/cache-test.tar

Now cache is not being used

$ docker build -t cache-test .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM busybox
 ---> 3240943c9ea3
Step 2 : RUN echo 'bbbb'
 ---> Running in c56df4a6e3f4
bbbb
 ---> 8e5bb62e1278
Removing intermediate container c56df4a6e3f4
Step 3 : RUN echo 'ffff'
 ---> Running in bf656c2b5385
ffff
 ---> 043911d06ec5
Removing intermediate container bf656c2b5385
Successfully built 043911d06ec5

When I do the same process with 1.9.1, cache is used as expected. Is this the expected behavior?


docker -v:Docker version 1.10.0, build 590d5108

docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 53
Server Version: 1.10.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 34
 Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
 Volume: local
 Network: host bridge null
Kernel Version: 3.13.0-24-generic
Operating System: Ubuntu 14.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.955 GiB
Name: vagrant-ubuntu-trusty
ID: ZEOX:ICBJ:GU66:P5OB:H5LD:4ZBV:HRFA:GF2K:JPGJ:RNVW:C5BM:6PCG
WARNING: No swap limit support

uname -a: Linux vagrant-ubuntu-trusty 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 31
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

So is it correct to say that since Docker 1.10, it is impossible to save (somehow) a local image and then at a later time, load it with the build cache intact? This means that you will always need to rebuild your entire image from scratch for every single commit, even if it’s just a simple HTML template change that would normally only invalidate the very last instruction in your Dockerfile? That’s pretty annoying. I just spent a few hours last night searching Google and trying various combinations of docker push/push and docker save/load to speed up our Travis CI builds, with no luck.

I knew docker pull filling cache was affected by this (that’s #20316), but I’m really surprised to learn that docker save (which is supposed to save all the metadata Docker has about an image in full on-disk) is also affected.