TL;DR: Disable BuildKit
Context
I have docker image with repository & tag same with FROM
image in Dockerfile. But when I build image, docker always pull metadata for check from docker hub and pull it.
➜ ~ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
confluentinc/cp-base 6.0.3 827d97cf9dd3 46 minutes ago 566MB
confluentinc/cp-base 6.0.3-1 827d97cf9dd3 46 minutes ago 566MB
confluentinc/cp-base latest 827d97cf9dd3 46 minutes ago 566MB
Dockerfile snippet
➜ ~ cat debian/zookeeper/Dockerfile
FROM confluentinc/cp-base:latest
EXPOSE 2181 2888 3888
ARG COMMIT_ID=unknown
LABEL io.confluent.docker.git.id=$COMMIT_ID
ARG BUILD_NUMBER=-1
LABEL io.confluent.docker.build.number=$BUILD_NUMBER
MAINTAINER partner-support@confluent.io
LABEL io.confluent.docker=true
ENV COMPONENT=zookeeper
RUN echo "===> installing ${COMPONENT}..." \
...
docker build --build-arg KAFKA_VERSION=5.3.3 --build-arg CONFLUENT_PLATFORM_LABEL= --build-arg CONFLUENT_MAJOR_VERSION=6 --build-arg CONFLUENT_MINOR_VERSION=0 --build-arg CONFLUENT_PATCH_VERSION=3 --build-arg COMMIT_ID=017a760 --build-arg BUILD_NUMBER=1 -t confluentinc/cp-zookeeper:latest -f debian/zookeeper/Dockerfile debian/zookeeper
[+] Building 5.3s (5/7)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/confluentinc/cp-base:latest 1.8s
=> [internal] load build context 0.0s
=> => transferring context: 662B 0.0s
=> CANCELED [1/3] FROM docker.io/confluentinc/cp-base:latest@sha256:3d39ae1ee2cbd023789726997192c59571fde83a7c499c250bd1f381671c48c8 3.4s
=> => resolve docker.io/confluentinc/cp-base:latest@sha256:3d39ae1ee2cbd023789726997192c59571fde83a7c499c250bd1f381671c48c8 0.0s
=> => sha256:8a45f3148b491bcd6e5276c2c87627e0837fb7a365a33d2d0042c9539ebd7c0d 1.05MB / 54.39MB 3.4s
=> => sha256:5fd1c1919136112f38da58359c6977b0e7b2bcbaecb8d54dec8c1c2e83160605 0B / 168.79MB 3.4s
=> => sha256:171a7e7c3b1354e376d6f4288780a1e9a7f38906787cb82eab66cc7c3dd02356 0B / 26.63MB
I try to change base image to confluentinc/cp-base:6.0.3
but not luck.
➜ ~ docker build --build-arg KAFKA_VERSION=5.3.3 --build-arg CONFLUENT_PLATFORM_LABEL= --build-arg CONFLUENT_MAJOR_VERSION=6 --build-arg CONFLUENT_MINOR_VERSION=0 --build-arg CONFLUENT_PATCH_VERSION=3 --build-arg COMMIT_ID=017a760 --build-arg BUILD_NUMBER=1 -t confluentinc/cp-zookeeper:latest -f debian/zookeeper/Dockerfile debian/zookeeper
[+] Building 1.9s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.77kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/confluentinc/cp-base:6.0.3
------
> [internal] load metadata for docker.io/confluentinc/cp-base:6.0.3:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: docker.io/confluentinc/cp-base:6.0.3: not found
+ exit 1
Solutions
I had experienced this issue after upgrading to the latest docker desktop version on mac. Solved with the comment on this issue
➜ ~ export DOCKER_BUILDKIT=0
➜ ~ export COMPOSE_DOCKER_CLI_BUILD=0
Try to build
➜ ~ docker build --build-arg KAFKA_VERSION=5.3.3 --build-arg CONFLUENT_PLATFORM_LABEL= --build-arg CONFLUENT_MAJOR_VERSION=6 --build-arg CONFLUENT_MINOR_VERSION=0 --build-arg CONFLUENT_PATCH_VERSION=3 --build-arg COMMIT_ID=017a760 --build-arg BUILD_NUMBER=1 --build-arg ALLOW_UNSIGNED=false --build-arg CONFLUENT_PACKAGES_REPO=https://packages.confluent.io --build-arg CONFLUENT_MVN_LABEL= -t confluentinc/cp-base:latest -f debian/base/Dockerfile debian/base
Sending build context to Docker daemon 20.48kB
Step 1/33 : FROM arm64v8/debian
latest: Pulling from arm64v8/debian
5a5d73d4b732: Already exists
Digest: sha256:ce9968e25305b047efd18a239629c58edf0d791439a3e5d595612763f07acf90
Status: Downloaded newer image for arm64v8/debian:latest
---> 37fe96a532d3
Step 2/33 : ARG COMMIT_ID=unknown
---> Running in 77c782900493
Removing intermediate container 77c782900493
---> d7f12cf16ed9
...
Yah It works!