cli icon indicating copy to clipboard operation
cli copied to clipboard

docker annotate can't remove variant

Open mickaelperrin opened this issue 3 years ago • 1 comments

Description

It seems currently impossible to remove a variant from an existing manifest.

Reproduce

docker manifest annotate IMAGE SUBIMAGE --variant ""

Expected behavior

docker manifest annotate IMAGE SUBIMAGE --variant "" should set the variant value to "". It currently leaves the previous value.

docker version

Client:
 Cloud integration: v1.0.31
 Version:           23.0.5
 API version:       1.42
 Go version:        go1.19.8
 Git commit:        bc4487a
 Built:             Wed Apr 26 16:12:52 2023
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.19.0 (106363)
 Engine:
  Version:          23.0.5
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.8
  Git commit:       94d3ad6
  Built:            Wed Apr 26 16:17:14 2023
  OS/Arch:          linux/arm64
  Experimental:     true
 containerd:
  Version:          1.6.20
  GitCommit:        2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc:
  Version:          1.1.5
  GitCommit:        v1.1.5-0-gf19387a
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     /Users/mickaelperrin/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.3
    Path:     /Users/mickaelperrin/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/mickaelperrin/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     /Users/mickaelperrin/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     /Users/mickaelperrin/.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/mickaelperrin/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/mickaelperrin/.docker/cli-plugins/docker-scan
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.10.0
    Path:     /Users/mickaelperrin/.docker/cli-plugins/docker-scout

Server:
 Containers: 102
  Running: 10
  Paused: 0
  Stopped: 92
 Images: 373
 Server Version: 23.0.5
 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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 23.45GiB
 Name: docker-desktop
 ID: a655468e-5f15-46b9-9731-eb2feae8830a
 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
 Registry: https://index.docker.io/v1/
 Experimental: true
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

I don't know why but suddenly my manifest create process seems to tag the architecture / os / variant based on the host running the command and not relatively to the image informations. I currently create multi arch images by building separetly on mac os for arm image and on intel linux for amd64. When I create the multi-arch manifest, the linux image is tagged with arm/v8 instead of linux/amd64. I added a docker manifest annotate in the process to correct the issue, but I am facing that reported issue.

mickaelperrin avatar Jun 14 '23 16:06 mickaelperrin

I'd like to work on this. docker manifest annotate only applies --variant (and --os-version) when the value is non-empty, so an explicit --variant "" is ignored. I plan to apply these flags whenever they are set (using cmd.Flags().Changed), so passing an empty value clears the field, and add a unit test for it.

GitNimay avatar Oct 19 '26 17:10 GitNimay