-
Notifications
You must be signed in to change notification settings - Fork 575
Closed
Description
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug and checked that ...
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
When using bake with the deduplicate context transfer strategy, and a container builder with default-load
enabled, the intermediate context target gets exported to the local image store, even if you set output to type=cacheonly
for that target in the bake file.
Expected behaviour
I don't expect anything to be loaded to the image store if I set output to type=cacheonly
Actual behaviour
The intermediate ctx
target gets loaded into the docker engine image store.
Buildx version
github.com/docker/buildx v0.16.0-rc1 b96ad59
Docker info
Client:
Version: 27.0.2
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.16.0-rc1
Path: /Users/david/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.28.1-desktop.1
Path: /Users/david/.docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.32
Path: /Users/david/.docker/cli-plugins/docker-debug
desktop: Docker Desktop commands (Alpha) (Docker Inc.)
Version: v0.0.14
Path: /Users/david/.docker/cli-plugins/docker-desktop
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: /Users/david/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.25
Path: /Users/david/.docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: /Users/david/.docker/cli-plugins/docker-feedback
harmonia: Extend your localhost with cloud workspaces (Docker Inc.)
Version: 0.13.45
Path: /Users/david/.docker/cli-plugins/docker-harmonia
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.3.0
Path: /Users/david/.docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/david/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.10.0
Path: /Users/david/.docker/cli-plugins/docker-scout
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 7
Server Version: 27.0.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
runc version: v1.1.13-0-g58aa920
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.6.35-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10
Total Memory: 7.656GiB
Name: docker-desktop
ID: 75238e2a-6aa2-4014-99c0-0f283162fdb3
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///Users/david/Library/Containers/com.docker.docker/Data/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
Builders list
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
container* docker-container
\_ container0 \_ desktop-linux running 1aee151 linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
default docker
\_ default \_ default running v0.14.1 linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
desktop-linux docker
\_ desktop-linux \_ desktop-linux running v0.14.1 linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
cloud-docker-default cloud error
Configuration
FROM scratch AS ctx
COPY --link . .
FROM scratch AS build
COPY --from=ctx . .
# docker-bake.hcl
target "ctx" {
context = "."
target = "ctx"
output = ["type=cacheonly"]
}
target "default" {
target = "build"
contexts = {
ctx = "target:ctx"
}
output = ["type=cacheonly"]
}
Build logs
#0 building with "container" instance using docker-container driver
#1 [internal] load local bake definitions
#1 reading docker-bake.hcl 193B / 193B done
#1 DONE 0.0s
#2 [ctx internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 116B done
#2 DONE 0.0s
#3 [default internal] load build definition from Dockerfile
#3 transferring dockerfile: 116B done
#3 DONE 0.0s
#4 [default internal] load .dockerignore
#4 transferring context: 50B done
#4 DONE 0.0s
#5 [ctx internal] load .dockerignore
#5 transferring context: 50B done
#5 DONE 0.0s
#6 [ctx internal] load build context
#6 transferring context: 144.14MB 1.0s done
#6 transferring context: 144.14MB 1.0s done
#6 DONE 1.0s
#7 [default build 1/1] COPY --from=ctx . .
#7 DONE 0.0s
#8 [ctx] exporting to docker image format
#8 exporting layers
#8 exporting layers 2.3s done
#8 exporting manifest sha256:ff271a2b205bc5187406e868efb1224e83ea799fdacccc961f9420108d5248bd
#8 exporting manifest sha256:ff271a2b205bc5187406e868efb1224e83ea799fdacccc961f9420108d5248bd done
#8 exporting config sha256:3db935e4c4a2433c2caae56addf6a595ad33d55aab7456f9fadbb36a83a04801 done
#8 sending tarball
#8 sending tarball 1.6s done
#8 DONE 3.9s
#9 importing to docker
#9 loading layer 8238470e6a44 557.06kB / 144.15MB 0.5s done
#9 DONE 0.5s
Additional info
$ buildx inspect
Name: container
Driver: docker-container
Last Activity: 2024-07-05 08:08:50 +0000 UTC
Nodes:
Name: container0
Endpoint: desktop-linux
Driver Options: default-load="true" image="moby/buildkit:master"
Status: running
BuildKit daemon flags: --allow-insecure-entitlement=network.host
BuildKit version: 1aee151
Platforms: linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
Labels:
org.mobyproject.buildkit.worker.executor: oci
org.mobyproject.buildkit.worker.hostname: 87ad539c209f
org.mobyproject.buildkit.worker.network: host
org.mobyproject.buildkit.worker.oci.process-mode: sandbox
org.mobyproject.buildkit.worker.selinux.enabled: false
org.mobyproject.buildkit.worker.snapshotter: overlayfs
GC Policy rule#0:
All: false
Filters: type==source.local,type==exec.cachemount,type==source.git.checkout
Keep Duration: 48h0m0s
Keep Bytes: 488.3MiB
GC Policy rule#1:
All: false
Keep Duration: 1440h0m0s
Keep Bytes: 5.588GiB
GC Policy rule#2:
All: false
Keep Bytes: 5.588GiB
GC Policy rule#3:
All: true
- I have tested with and without the containerd image store, same result.
- Using a builder without the
default-load
driver option does not load the intermediate context.