docker / docker/buildx

default value is not honoured for `tar` and `compression` while using `docker buildx build`

Open
#2,318 0 comments 0 reactions 0 assignees View on GitHub

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 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 docker buildx buildx --output "type=docker[,parameter]" . to build an image save it as tar file, the default values for compression and tar are not used.

Command used:

akhil@akhil-ThinkPad-L14:~/W/d/docker $ docker buildx build --output "type=docker,tar,compression" -t akhilerm/ubuntu:22.04-custom .
ERROR: invalid value tar

But as per the documentation here, both tar has a default value of true and compression defualts to gzip

Expected behaviour
akhil@akhil-ThinkPad-L14:~/W/d/docker $ docker buildx build --output "type=docker,tar,compression" -t akhilerm/ubuntu:22.04-custom .

Should trigger the build by using default values of tar and compression as gzip

Actual behaviour
akhil@akhil-ThinkPad-L14:~/W/d/docker $ docker buildx build --output "type=docker,tar,compression" -t akhilerm/ubuntu:22.04-custom .
ERROR: invalid value tar
Buildx version

Using buildx from master branch

Docker info
akhil@akhil-ThinkPad-L14:~/W/d/docker $ docker info
Client: Docker Engine - Community
 Version:    25.0.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.5
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 18
 Server Version: 25.0.3
 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: systemd
 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: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-97-generic
 Operating System: Ubuntu 22.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 23.47GiB
 Name: akhil-ThinkPad-L14
 ID: d16fc93b-9f2e-4dfa-b5e5-7adeb5cf5dea
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: akhil
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false


### Builders list

```text
akhil@akhil-ThinkPad-L14:~/W/d/docker $  docker buildx ls
NAME/NODE      DRIVER/ENDPOINT             STATUS  BUILDKIT PLATFORMS
sleepy_wing *  docker-container                             
  sleepy_wing0 unix:///var/run/docker.sock running v0.12.5  linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386
default        docker                                       
  default      default                     running v0.12.5  linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386
Configuration
FROM ubuntu:latest

RUN apt-get update -y
Build logs

No response

Additional info

The flags for output are parsed here. But default values are not considered while parsing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at util/buildflags/export.go around line 45, where the issue says output flags are parsed, and compare that behavior with the documented defaults in the Docker exporter synopsis. Reproduce the shown docker buildx build command and verify that tar and compression use their documented defaults instead of producing the invalid-value error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.