Skip to content

c8d: image load does not produce error if given platform doesn't exist #48589

@thaJeztah

Description

@thaJeztah

Description

I noticed this while writing docs for docker/cli#5331 - when specifying a --platform and the platform does not exist in the tar-file, no error is produced;

Reproduce

Loading the tar without specifying a platform loads all platforms that are present in the tar;

$ docker image load -i image.tar
Loaded image: alpine:latest

$ docker image ls --tree
IMAGE                   ID             DISK USAGE   CONTENT SIZE   USED
alpine:latest           beefdbd8a1da       20.6MB         11.1MB
├─ linux/s390x          2b5b26e09ca2       3.46MB         3.46MB
├─ linux/ppc64le        c7a6800e3dc5       3.57MB         3.57MB
├─ linux/arm64/v8       9cee2b382fe2       13.6MB         4.09MB
├─ linux/amd64          33735bd63cf8           0B             0B
├─ linux/arm/v6         50f635c8b04d           0B             0B
├─ linux/arm/v7         f2f82d424957           0B             0B
├─ linux/386            b3e87f642f5c           0B             0B
└─ linux/riscv64        80cde017a105           0B             0B

But when loading the same tar, and specifying an architecture that's not included, no error is produced;

$ docker image rm alpine:latest
Untagged: alpine:latest
Deleted: sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d

$ docker image load -i image.tar --platform=linux/riscv64
Loaded image: alpine:latest

$ docker image ls --tree
IMAGE           ID             DISK USAGE   CONTENT SIZE   USED
alpine:latest   beefdbd8a1da           0B             0B

Expected behavior

Loading the tar should produce an error that the requested platform was not found

docker version

Client:
 Version:           27.0.1-330-g3b97d5294.m
 API version:       1.48
 Go version:        go1.23.2
 Git commit:        3b97d5294
 Built:             Fri Oct  4 12:28:13 2024
 OS/Arch:           darwin/arm64
 Context:           default

Server:
 Engine:
  Version:          dev
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.22.7
  Git commit:       4001d0704ba38a82e1dbc26f0593fca66db1cb98
  Built:            Fri Oct  4 12:23:25 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.7.22
  GitCommit:        7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
 runc:
  Version:          1.1.14
  GitCommit:        v1.1.14-0-g2c9f560
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: dev
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: crun io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
 runc version: v1.1.14-0-g2c9f560
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 6.10.9-linuxkit
 Operating System: Debian GNU/Linux 12 (bookworm) (containerized)
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 7.654GiB
 Name: b0052b1e824d
 ID: 2a93c916-17ee-46f2-9c7d-5b3be2381e30
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 22
  Goroutines: 48
  System Time: 2024-10-07T10:07:40.409036801Z
  EventsListeners: 0
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

Using a CLI build from;

Metadata

Metadata

Assignees

Labels

area/apiAPIarea/imagesImage Servicecontainerd-integrationIssues and PRs related to containerd integrationkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.

Type

Projects

Status

Done

Status

Required for default containerd

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions