`docker buildx bake` does not support saving multiple targets to a single tarball
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
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
Attempting to output multiple targets to a single tarball results in a single random target being contained in the tarball, instead of all of them.
Expected behaviour
The generated tarball contains all images
Actual behaviour
The generated tarball contains a random image
Buildx version
github.com/docker/buildx 0.10.3 79e156beb11f697f06ac67fa1fb958e4762c0fab
Docker info
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.10.3
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.16.0
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 18
Running: 1
Paused: 0
Stopped: 17
Images: 691
Server Version: 23.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.2.1-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 30.13GiB
Name: pudge
ID: 6IXA:H6AE:DQUM:AHGY:WMLU:ZWJQ:BOJX:LRKK:EOH4:UJ7Y:ZN23:WRMK
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Builders list
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
beautiful_shamir * docker-container
beautiful_shamir0 unix:///var/run/docker.sock running v0.10.5 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
default docker
default default running 23.0.1 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
Configuration
With the following files,
docker-bake.hcl:
group "default" {
targets = ["redis", "python"]
}
target "redis" {
dockerfile = "Dockerfile_redis"
output = ["type=docker,dest=images.tar"]
tags = ["test_redis:latest"]
}
target "python" {
dockerfile = "Dockerfile_python"
output = ["type=docker,dest=images.tar"]
tags = ["test_python:latest"]
}
Dockerfile_python:
FROM python:3.11-alpine
Dockerfile_redis:
FROM redis:7-alpine
docker buildx bake -f docker-bake.hcl
Logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docker-bake.hcl, Dockerfile_redis, and Dockerfile_python, then run the reported docker buildx bake command to reproduce the tarball contents. Trace how the bake command handles multiple targets sharing type=docker,dest=images.tar, and consider the work complete when the generated tarball contains both images rather than one random target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100