Using --cache-from doesn't skip base image pull
### Summary From the issue gitlab-ce#17861 i thought to open a different issue to handle this bug. I opened also an issue on Docker [#31613](https://github.com/docker/docker/issues/31613). Testing on my PC doesn't reproduce the bug. I'm using a docker in docker runner with `dind` service, custom image and enabled `DOCKER_DRIVER: "overlay"` ### Steps to reproduce ``` - docker pull $CI_REGISTRY_IMAGE:latest || true - docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:${CI_BUILD_TAG:-"latest"} . ``` ### What is the current *bug* behavior? ``` Sending build context to Docker daemon 525.8 kB.8 kB Step 1/15 : FROM node:6.10-alpine 6.10-alpine: Pulling from library/node 709515475419: Downloading [==> ] 97.51 kB/2.313 MB 92aa7b64772e: Downloading [==> ] 654.5 kB/14.96 MB a32501522b97: Downloading [=> ] 32.77 kB/868.1 k ``` ### What is the expected *correct* behavior? ``` Sending build context to Docker daemon 525.8 kB.8 kB Step 1/15 : FROM node:6.10-alpine 6.10-alpine: Pulling from library/node 709515475419: Layer already exists 92aa7b64772e: Layer already exists a32501522b97: Layer already exists ``` ### Relevant logs and/or screenshots My PC ``` docker pull my-registry/my-ns/my-repo:latest docker inspect my-registry/my-ns/my-repo:latest "Layers": [ "sha256:9f8566ee5135862dd980160c27bd7721448a6f7f385bbb81f7f001f1b78a5fbf", "sha256:a29f1bf1f8df55abcb2230162480199bb2839e29e40b5d747cccce32a9696e86", "sha256:d7a4e57a4ae0051473917c87c590af2b2b95ad9517740fbe05b27b43e5dbfa4b", "sha256:07698cd9e86fb12172d2d5107b61bfc4dae20e6090064242f596b2f78bbf84b6", "sha256:25ca756563e9235141f201244b9a1c7442e8baf85bbf88452da7fdb142c576b0", "sha256:d2e3899823ec88e8cd8d0a4d95121d6b8f7a5e4a458797ad4eff84c29ffd3298", "sha256:48c5670911ab51293275891fe09b2cf5614c4fc2521f12fd9368d9fdfaa894e5", "sha256:78526f8a35d4ea416d9496dba4371e43d5ec24bed97c63abe37b007f006e0bc2", "sha256:68401271335738b06efb91d37289acf7e4f7412644f4b86bfb2396f3dde0c57a" ] docker build --cache-from my-registry/my-ns/my-repo:latest -t my-registry/my-ns/my-repo:latest . Sending build context to Docker daemon 539.1 kB Step 1/15 : FROM node:6.10-alpine 6.10-alpine: Pulling from library/node 709515475419: Already exists 92aa7b64772e: Already exists a32501522b97: Already exists Digest: sha256:4c028de86910dbd98269dee7ca7e81880bbf93c5f1d6fce7723198699da246c4 Status: Downloaded newer image for node:6.10-alpine ---> 8232a8b9c483 ``` Gitlab runner: ``` $ docker version Client: Version: 1.13.1 API version: 1.26 Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: linux/amd64 Server: Version: 17.03.0-ce API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 60ccb22 Built: Thu Mar 2 01:11:00 2017 OS/Arch: linux/amd64 Experimental: false $ docker inspect $CI_REGISTRY_IMAGE:latest "Layers": [ "sha256:9f8566ee5135862dd980160c27bd7721448a6f7f385bbb81f7f001f1b78a5fbf", "sha256:a29f1bf1f8df55abcb2230162480199bb2839e29e40b5d747cccce32a9696e86", "sha256:d7a4e57a4ae0051473917c87c590af2b2b95ad9517740fbe05b27b43e5dbfa4b", "sha256:07698cd9e86fb12172d2d5107b61bfc4dae20e6090064242f596b2f78bbf84b6", "sha256:25ca756563e9235141f201244b9a1c7442e8baf85bbf88452da7fdb142c576b0", "sha256:d2e3899823ec88e8cd8d0a4d95121d6b8f7a5e4a458797ad4eff84c29ffd3298", "sha256:48c5670911ab51293275891fe09b2cf5614c4fc2521f12fd9368d9fdfaa894e5", "sha256:78526f8a35d4ea416d9496dba4371e43d5ec24bed97c63abe37b007f006e0bc2", "sha256:68401271335738b06efb91d37289acf7e4f7412644f4b86bfb2396f3dde0c57a" ] ``` #### Results of GitLab environment info ``` System information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Sidekiq Version:4.2.7 GitLab information Version: 8.16.5 Revision: 064dab1 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://my-domain HTTP Clone URL: https://my-domain/some-group/some-project.git SSH Clone URL: git@my-domain:some-group/some-project.git Using LDAP: no Using Omniauth: no GitLab Shell Version: 4.1.1 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/ Git: /opt/gitlab/embedded/bin/git ``` #### Results of GitLab application Check ``` Checking GitLab Shell ... GitLab Shell version >= 4.1.1 ? ... OK (4.1.1) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 6/3 ... ok ... 14/235 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Checking Reply by email ... Reply by email is disabled in config/gitlab.yml Checking Reply by email ... Finished Checking LDAP ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab ... Git configured with autocrlf=input? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config outdated? ... no Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory setup correctly? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) projects have namespace: ... 6/3 ... yes ... 14/235 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.1.0 ? ... yes (2.3.3) Your git bin path is "/opt/gitlab/embedded/bin/git" Git version >= 2.7.3 ? ... yes (2.10.2) Active users: 19 Checking GitLab ... Finished ```
issue