Skip to content

Docker image save fails if the host platform image variant is not present locally #50173

@ctalledo

Description

@ctalledo

related;

Description

docker image save will fail if the host platform image variant is not present locally.

Reproduce

For example, on a linux/amd64 host, if I pull the image for other platforms but not the host platform, then a subsequent docker image save fails:

$ docker image pull --platform linux/arm64/v8 alpine:latest && docker image pull --platform linux/riscv64 alpine:latest

$ docker image ls --tree
alpine:latest           8a1f59ffb675       24.6MB         7.65MB                                                                        
├─ linux/amd64          08001109a7d6           0B             0B          <<< Host platform image not yet pulled
├─ linux/arm/v6         a1c858aaff07           0B             0B                                                                        
├─ linux/arm/v7         0b762e487f7a           0B             0B                                                                        
├─ linux/arm64/v8       008448246686       13.3MB         4.14MB                                                                                                                                                                                                                
├─ linux/386            af11d8e82a84           0B             0B                                                                                                                                                                                                                
├─ linux/ppc64le        b058f50906df           0B             0B                                                                                                                                                                                                                
├─ linux/riscv64        d17c97e1ccf6       11.2MB         3.52MB         
└─ linux/s390x          4b2235713e64           0B             0B  

$ docker image save -o b.tar alpine:latest
Error response from daemon: unable to create manifests file: NotFound: content digest sha256:08001109a7d679fe33b04fa51d681bd40b975d8f5cea8c3ef6c0eccb6a7338ce: not found

If I then pull the image for the host platform, then things work:

$ docker image pull alpine:latest

$ docker image ls --tree
IMAGE                   ID             DISK USAGE   CONTENT SIZE   EXTRA
alpine:latest           8a1f59ffb675       37.3MB         11.5MB        
├─ linux/amd64          08001109a7d6       12.8MB          3.8MB           <<< Host platform image pulled
├─ linux/arm/v6         a1c858aaff07           0B             0B        
├─ linux/arm/v7         0b762e487f7a           0B             0B        
├─ linux/arm64/v8       008448246686       13.3MB         4.14MB        
├─ linux/386            af11d8e82a84           0B             0B        
├─ linux/ppc64le        b058f50906df           0B             0B        
├─ linux/riscv64        d17c97e1ccf6       11.2MB         3.52MB        
└─ linux/s390x          4b2235713e64           0B             0B  

$ docker image save -o b.tar alpine:latest

Seem like a bug, AFAIK there's no requirement that the host platform image be present locally for docker save to succeed.

As an aside, things work if I explicitly pass the --platform option to docker image save (i.e., in that case the host platform image need not be present). This means that without --platform, the code is implicitly using --platform= which is not correct (i.e., Docker should just export all images that are present).

Expected behavior

docker image save should work regardless of whether the host platform image variant is locally present or not.

docker version

Client: Docker Engine - Community
 Version:           28.1.1                                  
 API version:       1.49
 Go version:        go1.23.8
 Git commit:        4eba377           
 Built:             Fri Apr 18 09:52:10 2025
 OS/Arch:           linux/amd64
 Context:           default

docker info

Client: Docker Engine - Community
 Version:    28.1.1
 Context:    default
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.1.7
    Path:     /home/cesar/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.23.0-desktop.1
    Path:     /home/cesar/.pinata/downloads/docker-plugins/v0.23.0-desktop.1/docker-buildx
  cloud: Docker Cloud (Docker Inc.)
    Version:  v0.3.4
    Path:     /home/cesar/.docker/cli-plugins/docker-cloud
  compose: Docker Compose (Docker Inc.)
    Version:  v2.36.0-desktop.1
    Path:     /home/cesar/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.41
    Path:     /home/cesar/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.1.9
    Path:     /home/cesar/.docker/cli-plugins/docker-desktop
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /home/cesar/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.27
    Path:     /home/cesar/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /home/cesar/.docker/cli-plugins/docker-init
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  dev
    Path:     /home/cesar/.docker/cli-plugins/docker-mcp
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /home/cesar/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.17.1
    Path:     /home/cesar/.docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 28.1.1
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 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 sysbox-runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.6-0-ge89a2992
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-60-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 31.07GiB
 Name: lenovo
 ID: 8ed40529-7ef1-4165-89f8-d7fcca71d8a9
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: [email protected]
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.25.0.0/16, Size: 24

Additional Info

No response

Metadata

Metadata

Assignees

Labels

area/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

Required for default containerd

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions