-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switching to use buildx to build docker images #4508
base: main
Are you sure you want to change the base?
Conversation
This commit enables to use `docker buildx` and make use of remote cache while building new images, to reuse unchanged layers instead of building them each time, thus speeding up building new Fabric container images. Signed-off-by: Artem Barger <[email protected]>
@@ -21,7 +21,7 @@ ifneq ($(NO_PROXY),) | |||
DOCKER_BUILD_FLAGS+=--build-arg 'NO_PROXY=$(NO_PROXY)' | |||
endif | |||
|
|||
DOCKER_BUILD ?= docker build --force-rm | |||
DOCKER_BUILD ?= docker buildx build --force-rm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this, but I get an error:
unknown flag: --force-rm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you run make docker
? Which version do you have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denyeart it suppose to work, see here: https://docs.docker.com/engine/reference/commandline/buildx_build/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you run
make docker
? Which version do you have?
Yes I'm using make docker
.
✗ docker version
Client:
Cloud integration: v1.0.35+desktop.5
Version: 24.0.6
API version: 1.43
Go version: go1.20.7
Git commit: ed223bc
Built: Mon Sep 4 12:28:49 2023
OS/Arch: darwin/amd64
Context: desktop-linux
Server: Docker Desktop 4.24.2 (124339)
Engine:
Version: 24.0.6
API version: 1.43 (minimum version 1.12)
Go version: go1.20.7
Git commit: 1a79695
Built: Mon Sep 4 12:32:16 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.22
GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca
runc:
Version: 1.1.8
GitCommit: v1.1.8-0-g82f18fe
docker-init:
Version: 0.19.0
GitCommit: de40ad0
✗ docker buildx version
github.com/docker/buildx v0.11.2-desktop.5 f20ec1393426619870066baba9618cf999063886
I'm still not seeing --force-rm
option:
✗ docker buildx build --help
Usage: docker buildx build [OPTIONS] PATH | URL | -
Start a build
Aliases:
docker buildx build, docker buildx b
Options:
--add-host strings Add a custom host-to-IP mapping (format: "host:ip")
--allow strings Allow extra privileged entitlement (e.g., "network.host", "security.insecure")
--attest stringArray Attestation parameters (format: "type=sbom,generator=image")
--build-arg stringArray Set build-time variables
--build-context stringArray Additional build contexts (e.g., name=path)
--builder string Override the configured builder instance
--cache-from stringArray External cache sources (e.g., "user/app:cache", "type=local,src=path/to/dir")
--cache-to stringArray Cache export destinations (e.g., "user/app:cache", "type=local,dest=path/to/dir")
--cgroup-parent string Optional parent cgroup for the container
-f, --file string Name of the Dockerfile (default: "PATH/Dockerfile")
--iidfile string Write the image ID to the file
--label stringArray Set metadata for an image
--load Shorthand for "--output=type=docker"
--metadata-file string Write build result metadata to the file
--network string Set the networking mode for the "RUN" instructions during build (default "default")
--no-cache Do not use cache when building the image
--no-cache-filter stringArray Do not cache specified stages
-o, --output stringArray Output destination (format: "type=local,dest=path")
--platform stringArray Set target platform for build
--progress string Set type of progress output ("auto", "plain", "tty"). Use plain to show container output (default "auto")
--provenance string Shorthand for "--attest=type=provenance"
--pull Always attempt to pull all referenced images
--push Shorthand for "--output=type=registry"
-q, --quiet Suppress the build output and print image ID on success
--sbom string Shorthand for "--attest=type=sbom"
--secret stringArray Secret to expose to the build (format: "id=mysecret[,src=/local/secret]")
--shm-size bytes Size of "/dev/shm"
--ssh stringArray SSH agent socket or keys to expose to the build (format: "default|<id>[=<socket>|<key>[,<key>]]")
-t, --tag stringArray Name and optionally a tag (format: "name:tag")
--target string Set the target build stage to build
--ulimit ulimit Ulimit options (default [])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me:
yacovm ~/gopath/src/github.com/hyperledger/fabric (dckr-bldx)$ make docker
Building Docker image hyperledger/fabric-baseos
docker buildx build --force-rm -f images/baseos/Dockerfile \
--build-arg GO_VER=1.21.3 \
--build-arg UBUNTU_VER=20.04 \
--build-arg FABRIC_VER=3.0.0 \
--build-arg TARGETARCH=amd64 \
--build-arg TARGETOS=linux \
\
--cache-to type=inline,mode=max \
--cache-from type=registry,ref=hyperledger/fabric-baseos:3.0.0 \
-t hyperledger/fabric-baseos \
-t hyperledger/fabric-baseos:3.0.0 \
-t hyperledger/fabric-baseos:3.0 \
./images/baseos
[+] Building 16.8s (10/10) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.01kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 3.6s
=> ERROR importing cache manifest from hyperledger/fabric-baseos:3.0.0 1.4s
=> [1/4] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 2.2s
=> => resolve docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 0.0s
=> => sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 1.13kB / 1.13kB 0.0s
=> => sha256:218bb51abbd1864df8be26166f847547b3851a89999ca7bfceb85ca9b5d2e95d 424B / 424B 0.0s
=> => sha256:bf40b7bc7a11b43785755d3c5f23dee03b08e988b327a2f10b22d01d5dc5259d 2.30kB / 2.30kB 0.0s
=> => sha256:96d54c3075c9eeaed5561fd620828fd6bb5d80ecae7cb25f9ba5f7d88ea6e15c 27.51MB / 27.51MB 1.1s
=> => extracting sha256:96d54c3075c9eeaed5561fd620828fd6bb5d80ecae7cb25f9ba5f7d88ea6e15c 1.0s
=> [2/4] RUN apt update && apt install -y tzdata 8.2s
=> [3/4] RUN addgroup --gid 500 chaincode 0.4s
=> [4/4] RUN adduser --disabled-password --gecos "" --uid 500 --gid 500 --home /home/chaincode chaincode 0.6s
=> preparing layers for inline cache 0.3s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:2a99df2ec1d1b155b937a00178f9e0804753ca22ac28e98b0d41cd82deccab7b 0.0s
=> => naming to docker.io/hyperledger/fabric-baseos 0.0s
=> => naming to docker.io/hyperledger/fabric-baseos:3.0.0 0.0s
=> => naming to docker.io/hyperledger/fabric-baseos:3.0 0.0s
------
> importing cache manifest from hyperledger/fabric-baseos:3.0.0:
------
Building Docker image hyperledger/fabric-ccenv
docker buildx build --force-rm -f images/ccenv/Dockerfile \
--build-arg GO_VER=1.21.3 \
--build-arg UBUNTU_VER=20.04 \
--build-arg FABRIC_VER=3.0.0 \
--build-arg TARGETARCH=amd64 \
--build-arg TARGETOS=linux \
\
--cache-to type=inline,mode=max \
--cache-from type=registry,ref=hyperledger/fabric-ccenv:3.0.0 \
-t hyperledger/fabric-ccenv \
-t hyperledger/fabric-ccenv:3.0.0 \
-t hyperledger/fabric-ccenv:3.0 \
./images/ccenv
[+] Building 238.2s (5/11) docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.31kB 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 0.7s
=> ERROR importing cache manifest from hyperledger/fabric-ccenv:3.0.0 2.7s
=> CACHED [1/7] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 [+] Building 364.6s (13/13) FINISHED docker:default
=> [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.31kB 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 0.7s => ERROR importing cache manifest from hyperledger/fabric-ccenv:3.0.0 2.7s
=> CACHED [1/7] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 0.0s => [2/7] RUN apt update && apt install -y binutils-gold curl g++ gcc git 352.0s
=> [3/7] RUN curl -sL https://go.dev/dl/go1.21.3.linux-amd64.tar.gz | tar zxvf - -C /usr/local 5.7s => [4/7] RUN addgroup --gid 500 chaincode 0.4s
=> [5/7] RUN adduser --disabled-password --gecos "" --uid 500 --gid 500 --home /home/chaincode chaincode 0.5s => [6/7] RUN mkdir -p /chaincode/output /chaincode/input 0.3s
=> [7/7] RUN chown -R chaincode:chaincode /chaincode 0.4s => preparing layers for inline cache 1.7s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:16e4f596728b36e359a319c9bb3fcba2ca385eef6652dbfe5c8ba8407eca916c 0.0s
=> => naming to docker.io/hyperledger/fabric-ccenv 0.0s
=> => naming to docker.io/hyperledger/fabric-ccenv:3.0.0 0.0s
=> => naming to docker.io/hyperledger/fabric-ccenv:3.0 0.0s
------
> importing cache manifest from hyperledger/fabric-ccenv:3.0.0:
------
Building Docker image hyperledger/fabric-orderer
docker buildx build --force-rm -f images/orderer/Dockerfile \
--build-arg GO_VER=1.21.3 \
--build-arg UBUNTU_VER=20.04 \
--build-arg FABRIC_VER=3.0.0 \
--build-arg TARGETARCH=amd64 \
--build-arg TARGETOS=linux \
--build-arg GO_TAGS= \
--cache-to type=inline,mode=max \
--cache-from type=registry,ref=hyperledger/fabric-orderer:3.0.0 \
-t hyperledger/fabric-orderer \
-t hyperledger/fabric-orderer:3.0.0 \
-t hyperledger/fabric-orderer:3.0 \
./
[+] Building 633.4s (17/17) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.29kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 336B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 1.6s
=> ERROR importing cache manifest from hyperledger/fabric-orderer:3.0.0 2.4s
=> CACHED [builder 1/5] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 0.0s
=> [internal] load build context 1.2s
=> => transferring context: 41.86MB 1.1s
=> [stage-1 2/6] RUN echo 'hosts: files dns' > /etc/nsswitch.conf 0.8s
=> [builder 2/5] RUN apt update && apt install -y git gcc curl make 604.5s
=> [builder 3/5] RUN curl -sL https://go.dev/dl/go1.21.3.linux-amd64.tar.gz | tar zxf - -C /usr/local 9.6s
=> [builder 4/5] ADD . . 2.0s
=> [builder 5/5] RUN make orderer GO_TAGS= FABRIC_VER=3.0.0 12.5s
=> [stage-1 3/6] COPY --from=builder build/bin/orderer /usr/local/bin 0.2s
=> [stage-1 4/6] COPY --from=builder sampleconfig/msp /var/hyperledger/fabric/config/msp 0.1s
=> [stage-1 5/6] COPY --from=builder sampleconfig/orderer.yaml /var/hyperledger/fabric/config 0.1s
=> [stage-1 6/6] COPY --from=builder sampleconfig/configtx.yaml /var/hyperledger/fabric/config 0.1s
=> preparing layers for inline cache 0.1s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:63d485503f2d6f3ceac2a14ca9dcaf261dd959951b5007f22148073269fef8fc 0.0s
=> => naming to docker.io/hyperledger/fabric-orderer 0.0s
=> => naming to docker.io/hyperledger/fabric-orderer:3.0.0 0.0s
=> => naming to docker.io/hyperledger/fabric-orderer:3.0 0.0s
------
> importing cache manifest from hyperledger/fabric-orderer:3.0.0:
------
Building Docker image hyperledger/fabric-peer
docker buildx build --force-rm -f images/peer/Dockerfile \
--build-arg GO_VER=1.21.3 \
--build-arg UBUNTU_VER=20.04 \
--build-arg FABRIC_VER=3.0.0 \
--build-arg TARGETARCH=amd64 \
--build-arg TARGETOS=linux \
--build-arg GO_TAGS= \
--cache-to type=inline,mode=max \
--cache-from type=registry,ref=hyperledger/fabric-peer:3.0.0 \
-t hyperledger/fabric-peer \
-t hyperledger/fabric-peer:3.0.0 \
-t hyperledger/fabric-peer:3.0 \
./
[+] Building 24.3s (18/18) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.38kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 336B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 2.2s
=> ERROR importing cache manifest from hyperledger/fabric-peer:3.0.0 1.7s
=> [internal] load build context 0.3s
=> => transferring context: 1.16MB 0.3s
=> CACHED [builder 1/6] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 0.0s
=> [stage-1 2/6] RUN echo 'hosts: files dns' > /etc/nsswitch.conf 0.3s
=> CACHED [builder 2/6] RUN apt update && apt install -y git gcc curl make 0.0s
=> CACHED [builder 3/6] RUN curl -sL https://go.dev/dl/go1.21.3.linux-amd64.tar.gz | tar zxf - -C /usr/local 0.0s
=> CACHED [builder 4/6] ADD . . 0.0s
=> [builder 5/6] RUN make peer GO_TAGS= FABRIC_VER=3.0.0 16.1s
=> [builder 6/6] RUN make ccaasbuilder 3.1s
=> [stage-1 3/6] COPY --from=builder build/bin/peer /usr/local/bin 0.1s
=> [stage-1 4/6] COPY --from=builder sampleconfig/msp /var/hyperledger/fabric/config/msp 0.1s
=> [stage-1 5/6] COPY --from=builder sampleconfig/core.yaml /var/hyperledger/fabric/config/core.yaml 0.1s
=> [stage-1 6/6] COPY --from=builder release/linux-amd64/builders/ccaas/bin /opt/hyperledger/ccaas_builder/bin 0.1s
=> preparing layers for inline cache 0.2s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:3088037512ef1d7e6e453ce4cd28243c94f662cebed6a72fed152d40ee91b604 0.0s
=> => naming to docker.io/hyperledger/fabric-peer 0.0s
=> => naming to docker.io/hyperledger/fabric-peer:3.0.0 0.0s
=> => naming to docker.io/hyperledger/fabric-peer:3.0 0.0s
------
> importing cache manifest from hyperledger/fabric-peer:3.0.0:
------
Building Docker image hyperledger/fabric-tools
docker buildx build --force-rm -f images/tools/Dockerfile \
--build-arg GO_VER=1.21.3 \
--build-arg UBUNTU_VER=20.04 \
--build-arg FABRIC_VER=3.0.0 \
--build-arg TARGETARCH=amd64 \
--build-arg TARGETOS=linux \
--build-arg GO_TAGS= \
--cache-to type=inline,mode=max \
--cache-from type=registry,ref=hyperledger/fabric-tools:3.0.0 \
-t hyperledger/fabric-tools \
-t hyperledger/fabric-tools:3.0.0 \
-t hyperledger/fabric-tools:3.0 \
./
[+] Building 398.1s (10/15) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.33kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 336B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 1.1s
=> ERROR importing cache manifest from hyperledger/fabric-tools:3.0.0 4.2s
=> CACHED [builder 1/5] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 1.16MB 0.3s
=> [stage-1 2/6] RUN apt update && apt install -y bash curl jq tzdata 3[+] Building [+] Building 398.4s (10/15) docker:default
=> [internal] load build definition from Dockerfile 0.0sf => => transferring dockerfile: 2.33kB 0.0s
=> [internal] load .dockerignore 0.0sf => => transferring context: 336B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 1.1sp => ERROR importing cache manifest from hyperledger/fabric-tools:3.0.0 4.2s
[+] Building 699.3s (17/17) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 2.33kB 0.0s
=> [internal] load .dockerignore 0.0s => => transferring context: 336B 0.0s => [internal] load metadata for docker.io/library/ubuntu:20.04 1.1s
=> ERROR importing cache manifest from hyperledger/fabric-tools:3.0.0 4.2s => CACHED [builder 1/5] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 0.0s => [internal] load build context 0.3s
=> => transferring context: 1.16MB 0.3s => [stage-1 2/6] RUN apt update && apt install -y bash curl jq tzdata 676.8s => CACHED [builder 2/5] RUN apt update && apt install -y git gcc curl make 0.0s
=> CACHED [builder 3/5] RUN curl -sL https://go.dev/dl/go1.21.3.linux-amd64.tar.gz | tar zxf - -C /usr/local 0.0s => CACHED [builder 4/5] ADD . . 0.0s => [builder 5/5] RUN make tools GO_TAGS= FABRIC_VER=3.0.0 24.5s
=> [stage-1 3/6] RUN curl -sL https://go.dev/dl/go1.21.3.linux-amd64.tar.gz | tar zxvf - -C /usr/local 14.6s => [stage-1 4/6] RUN echo 'hosts: files dns' > /etc/nsswitch.conf 0.4s => [stage-1 5/6] COPY --from=builder sampleconfig /var/hyperledger/fabric/config 0.1s
=> [stage-1 6/6] COPY --from=builder build/bin /usr/local/bin 0.5s => preparing layers for inline cache 1.5s => exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:562b0111c104fe9267b129e6cd0a8ee7fdc653f910701f3dcb42a0da8e34d6c4 0.0s
=> => naming to docker.io/hyperledger/fabric-tools 0.0s
=> => naming to docker.io/hyperledger/fabric-tools:3.0.0 0.0s
=> => naming to docker.io/hyperledger/fabric-tools:3.0 0.0s------
> importing cache manifest from hyperledger/fabric-tools:3.0.0:
------
cd ccaas_builder && go test -v ./cmd/detect && GOOS=linux GOARCH=amd64 go build -buildvcs=false -o ../release/linux-amd64/builders/ccaas/bin/ ./cmd/detect/
=== RUN TestArugments
=== RUN TestArugments/toofew
=== RUN TestArugments/twomany
=== RUN TestArugments/validtype
=== RUN TestArugments/wrongtype
--- PASS: TestArugments (0.26s)
--- PASS: TestArugments/toofew (0.02s)
--- PASS: TestArugments/twomany (0.01s)
--- PASS: TestArugments/validtype (0.01s)
--- PASS: TestArugments/wrongtype (0.01s)
=== RUN TestMissingFile
--- PASS: TestMissingFile (0.21s)
PASS
ok github.com/hyperledger/fabric/ccaas_builder/cmd/detect 0.473s
cd ccaas_builder && go test -v ./cmd/build && GOOS=linux GOARCH=amd64 go build -buildvcs=false -o ../release/linux-amd64/builders/ccaas/bin/ ./cmd/build/
=== RUN TestArguements
=== RUN TestArguements/toofew2
=== RUN TestArguements/twomany
=== RUN TestArguements/toofew1
--- PASS: TestArguements (0.30s)
--- PASS: TestArguements/toofew2 (0.03s)
--- PASS: TestArguements/twomany (0.01s)
--- PASS: TestArguements/toofew1 (0.01s)
=== RUN TestGoodPath
--- PASS: TestGoodPath (0.25s)
=== RUN TestTemplating
--- PASS: TestTemplating (0.25s)
=== RUN TestTemplatingFailure
--- PASS: TestTemplatingFailure (0.26s)
=== RUN TestMissingConnection
--- PASS: TestMissingConnection (0.25s)
=== RUN TestMissingMetadata
--- PASS: TestMissingMetadata (0.27s)
PASS
ok github.com/hyperledger/fabric/ccaas_builder/cmd/build 1.581s
cd ccaas_builder && go test -v ./cmd/release && GOOS=linux GOARCH=amd64 go build -buildvcs=false -o ../release/linux-amd64/builders/ccaas/bin/ ./cmd/release/
=== RUN TestArugments
=== RUN TestArugments/toofew
=== RUN TestArugments/twomany
--- PASS: TestArugments (0.22s)
--- PASS: TestArugments/toofew (0.02s)
--- PASS: TestArugments/twomany (0.01s)
=== RUN TestGoodPath
--- PASS: TestGoodPath (0.20s)
=== RUN TestMissingConnection
--- PASS: TestMissingConnection (0.21s)
PASS
ok github.com/hyperledger/fabric/ccaas_builder/cmd/release 0.634s
yacovm ~/gopath/src/github.com/hyperledger/fabric (dckr-bldx)$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger/fabric-tools 3.0 562b0111c104 22 seconds ago 520MB
hyperledger/fabric-tools 3.0.0 562b0111c104 22 seconds ago 520MB
hyperledger/fabric-tools latest 562b0111c104 22 seconds ago 520MB
hyperledger/fabric-peer 3.0 3088037512ef 12 minutes ago 133MB
hyperledger/fabric-peer 3.0.0 3088037512ef 12 minutes ago 133MB
hyperledger/fabric-peer latest 3088037512ef 12 minutes ago 133MB
hyperledger/fabric-orderer 3.0 63d485503f2d 12 minutes ago 103MB
hyperledger/fabric-orderer 3.0.0 63d485503f2d 12 minutes ago 103MB
hyperledger/fabric-orderer latest 63d485503f2d 12 minutes ago 103MB
hyperledger/fabric-ccenv 3.0 16e4f596728b 23 minutes ago 626MB
hyperledger/fabric-ccenv 3.0.0 16e4f596728b 23 minutes ago 626MB
hyperledger/fabric-ccenv latest 16e4f596728b 23 minutes ago 626MB
hyperledger/fabric-baseos 3.0 2a99df2ec1d1 29 minutes ago 125MB
hyperledger/fabric-baseos 3.0.0 2a99df2ec1d1 29 minutes ago 125MB
hyperledger/fabric-baseos latest 2a99df2ec1d1 29 minutes ago 125MB
yacovm ~/gopath/src/github.com/hyperledger/fabric (dckr-bldx)$ git log --oneline
ab6bef381 (HEAD -> dckr-bldx) Switching to use buildx to build docker images
@@ -249,6 +249,8 @@ $(BUILD_DIR)/images/%/$(DUMMY): | |||
--build-arg TARGETARCH=$(ARCH) \ | |||
--build-arg TARGETOS=linux \ | |||
$(BUILD_ARGS) \ | |||
--cache-to type=inline,mode=max \ | |||
--cache-from type=registry,ref=$(DOCKER_NS)/fabric-$*:$(FABRIC_VER) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When building FABRIC_VER (e.g. 3.0.0
) image, a prior FABRIC_VER 3.0.0
will not exist in the registry yet. So I'm not understanding how the cache would work. Can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, time it won't have, while once pushed, the rest of the builds will utilize cached layers if no changes have been made to the layers. Here some more details: https://lipanski.com/posts/speed-up-your-docker-builds-with-cache-from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, as a matter of fact, I wanted to see whether enabling cache is worth it.
This commit enables to use
docker buildx
and make use of remote cache while building new images to reuse unchanged layers instead of building them each time, thus speeding up building new Fabric container images.