Clarify how to resolve pushing a single platform from a multi-platform image index #5242
Copy link
Copy link
Closed
Labels
area/uxcontainerd-integrationIssues and PRs related to containerd integrationIssues and PRs related to containerd integrationkind/bug
Description
Description
docker push note is unclear, and refers to an unknown docker convert command.
I'm running Lima on macOS to build linux/amd64 images, and this note appears for each push.
Might be more useful to explain how to resolve this, as it's unclear initially to me how to fix this. Looking back through the relevant PR, it states that it now expects a --platform flag when running docker pull or docker push.
Reproduce
- create a simple Dockerfile
FROM python:3.10-slim CMD ["/bin/bash"]
docker build . -t example:latestdocker push example:latest
Expected behavior
Would expect the note to at least state using the --platform flag, or if there is a system-wide workaround for this as well.
docker version
Client: Docker Engine - Community
Version: 27.0.3
API version: 1.46
Go version: go1.22.4
Git commit: 7d4bcd863a
Built: Fri Jun 28 14:56:30 2024
OS/Arch: darwin/arm64
Context: lima-default
Server: Docker Engine - Community
Engine:
Version: 27.0.3
API version: 1.46 (minimum version 1.24)
Go version: go1.21.11
Git commit: 662f78c
Built: Sat Jun 29 00:02:23 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.18
GitCommit: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
runc:
Version: 1.7.18
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
rootlesskit:
Version: 2.0.2
ApiVersion: 1.1.1
NetworkDriver: slirp4netns
PortDriver: builtin
StateDir: /run/user/502/dockerd-rootless
slirp4netns:
Version: 1.2.1
GitCommit: 09e31e92fa3d2a1d3ca261adaeb012c8d75a8194docker info
Client: Docker Engine - Community
Version: 27.0.3
Context: lima-default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.15.1
Path: /Users/eric.young/.docker/cli-plugins/docker-buildx
WARNING: Plugin "/Users/eric.young/.docker/cli-plugins/docker-compose" is not valid: failed to fetch metadata: fork/exec /Users/eric.young/.docker/cli-plugins/docker-compose: no such file or directory
Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 27.0.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: true
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: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
runc version: v1.1.13-0-g58aa920
init version: de40ad0
Security Options:
seccomp
Profile: builtin
rootless
cgroupns
Kernel Version: 6.8.0-36-generic
Operating System: Ubuntu 24.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.75GiB
Name: lima-default
ID: f9d1213f-d5db-4580-8a1f-0d87cdd1b665
Docker Root Dir: /home/lima.linux/.local/share/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabledAdditional Info
Note I have the following two Docker-related environment variables set in my ~/.zshrc:
export DOCKER_DEFAULT_PLATFORM=linux/amd64
export DOCKER_CONTEXT=lima-defaultReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/uxcontainerd-integrationIssues and PRs related to containerd integrationIssues and PRs related to containerd integrationkind/bug
Activity
vvoland commentedon Jul 8, 2024
Thanks for the report!
DOCKER_DEFAULT_PLATFORM=linux/amd64sets the--platformfor every CLI command invocation, which makes it fail becauseplatformis not supported before API 1.46.Simply unsetting the
DOCKER_DEFAULT_PLATFORMvariable will make it work.Is there a specific reason you set this variable?
ESKYoung commentedon Jul 8, 2024
Honestly? Forgetfulness 😅
I'm predominately building x86-64 images to run on Cloud infrastructure, such as Google Cloud Run; when I build locally on my ARM macOS (and not on a Linux VM) I set the env variable so I don't accidental build an ARM image that won't run on Cloud RUN.
I do note that using
FROM --platform=linux/amd64doesn't seem to raise the note, so maybe I'll use this going forward! Thanks @vvoland for the quick response!vvoland commentedon Jul 8, 2024
We definitely shouldn't default the
--platformvalue to anything if using API version before 1.46 though.I opened a PR to fix that, and also removed the
docker convertmention (as it's not present yet 🙈).Thanks!