buildkit: Build fails when FROM image isn't cached
My dockerfile has a first line like:
FROM golang:1.13.4 as binary_tools_context
When building this, I get the following error:
$ docker buildx build .
[+] Building 1.8s (27/176)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 19.49kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/golang:1.13.4 0.3s
=> [internal] load metadata for docker.io/library/ubuntu:bionic 0.0s
=> CACHED [clang_context 1/6] FROM docker.io/library/ubuntu:bionic 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 4.77kB 0.0s
=> https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz 1.0s
=> CANCELED https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-265.0.0-linux-x86_64.tar.gz 1.0s
=> CANCELED https://nodejs.org/download/release/v12.8.0/node-v12.8.0-linux-x64.tar.gz 1.0s
=> CANCELED https://github.com/ncopa/su-exec/archive/v0.2.tar.gz 0.1s
=> CANCELED https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.3.tar.gz 0.8s
=> CANCELED https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_am 0.1s
=> CANCELED [ruby_tools_context 2/14] RUN apt-get update && apt-get install -y --no-install-recommends build-essential c 1.0s
=> CANCELED https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/amd64/kubectl 0.1s
=> CANCELED https://github.com/mikefarah/yq/releases/download/2.4.0/yq_linux_amd64 0.1s
=> CANCELED https://download.docker.com/linux/ubuntu/gpg 0.1s
=> CANCELED https://storage.googleapis.com/kubernetes-helm/helm-v2.16.1-linux-amd64.tar.gz 0.1s
=> CANCELED [base_os_context 2/19] RUN apt-get update && apt-get install -y --no-install-recommends apt-transport-https 0.8s
=> CANCELED [python_context 2/8] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl 1.1s
=> CANCELED https://github.com/gohugoio/hugo/releases/download/v0.58.2/hugo_0.58.2_Linux-64bit.tar.gz 0.1s
=> CANCELED https://github.com/hadolint/hadolint/releases/download/v1.17.2/hadolint-Linux-x86_64 0.1s
=> CANCELED https://storage.googleapis.com/shellcheck/shellcheck-v0.7.0.linux.x86_64.tar.xz 0.1s
=> CANCELED https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz 0.1s
=> CANCELED [bazel_context 2/5] RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates & 1.2s
=> CANCELED [clang_context 2/6] RUN apt-get update && apt-get install -y --no-install-recommends xz-utils wget ca-ce 1.4s
=> CANCELED https://github.com/protocolbuffers/protobuf/releases/download/v3.9.2/protoc-3.9.2-linux-x86_64.zip 0.1s
=> ERROR [binary_tools_context 1/77] FROM docker.io/library/golang:1.13.4 0.1s
=> => resolve docker.io/library/golang:1.13.4 0.1s
------
> [internal] load metadata for docker.io/library/golang:1.13.4:
------
------
> [binary_tools_context 1/77] FROM docker.io/library/golang:1.13.4:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: docker.io/library/golang:1.13.4 not found
If I docker pull docker.io/library/golang:1.13.4 everything works
Any suggestions? Is this user error? I assume not since it works with standard docker build but maybe I missed some docs around this
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 27 (4 by maintainers)
Commits related to this issue
- docker buildx requires pre-pulling images At least with cloudbuild, likely related to https://github.com/moby/buildkit/issues/1271 — committed to justinsb/cluster-addons by justinsb 4 years ago
- fix(runner): disable buildkit due to moby/buildkit#1271 Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com> — committed to inloco/kube-actions by t0rr3sp3dr0 4 years ago
- prepull ubuntu:focal for use with buildkit there are issues with containerd+buildkit when referencing an image that is not already cached. See https://github.com/moby/buildkit/issues/1271. Instead, w... — committed to codenrhoden/image-builder by codenrhoden 3 years ago
For those still having issues with this, we configured a global env var:
DOCKER_BUILDKIT=0as temporary workaround. Note that this does disable buildkit as a whole, but this was pretty much the only thing which worked for us.@Lakshpiya Creating an account / signing in does not help.
I experience the same issue. I have to run an initial build with
DOCKER_BUILDKIT=0. Follow-up runs work fine withDOCKER_BUILDKIT=1. Seems to fail downloading the image with buildkit.docker info
I’m still having issues with this as well, I had to disable buildkit for one of my docker builds. Maybe this should be reopened?
https://github.com/moby/buildkit/issues/1142#issuecomment-696987398
Same here. I got this issue after pruning and was unable to recover. Only
DOCKER_BUILDKIT=0 docker buildworks.use docker login command and then provide user login account detail once login success then try again docker build command It will work.
This issue seems to be returned. Same here.
I ran into this same issue.
Solved it by running
docker pull docker.io/library/rabbitmq:3.5.7-management@sha256:ceee535cb3ca8f24914d43583fd559887f01eaa9a6ef698791b47cc4097d0876and then running build again.Same here. Docker version 20.10.5, build 55c4c88 and had to use the DOCKER_BUILDKIT=0.
@tonistiigi
Here is what I did just now:
So seems to be persistent
I got this problem because I have a typo in my
DockerfileFROM.I just wanna set this thing on fire after 3 hours of debugging. DOCKER_BUILDKIT=0 solved this issue
Same issue here: Docker 20.10.6 on Ubuntu 20.4 BuildX v0.5.1-docker
I had to ENABLE
DOCKER_BUILDKITbecause--mount=type=cache,target=/tmp/cachestarted requiring BUILDKIT and making our builds fail on Github CI (We probably forgot to pin our builder base image, but okay).Anyway, I thought “What a good reminder to move ahead and enable Buildkit”.
Well, now I get this exact error as well. Gonna just pin our build image to a previous release, as I should have, from the start.
@felipecrs Running
docker infoprovides the version number for BuildKit for Docker in the current environment. Look for the line containingbuildx.