cli icon indicating copy to clipboard operation
cli copied to clipboard

binfmt setup not mentioned outside of Docker Desktop docs

Open marcpawl opened this issue 2 years ago • 1 comments

Description

--platform option is not executing using qemu for ARM64

Steps to reproduce the issue:

root@jammy:/home/x# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
root@jammy:/home/x# docker run --platform=linux/arm64 ubuntu:focal uname -p
Unable to find image 'ubuntu:focal' locally
focal: Pulling from library/ubuntu
11e23ac719b3: Pull complete
Digest: sha256:fd92c36d3cb9b1d027c4d2a72c6bf0125da82425fc2ca37c414d4f010180dc19
Status: Downloaded newer image for ubuntu:focal
exec /usr/bin/uname: exec format error

Describe the results you received:

exec /usr/bin/uname: exec format error

Describe the results you expected:

aarch64

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

root@jammy:/home/x# docker version
Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:02:46 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:00:51 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
root@jammy:/home/x# uname -a
Linux jammy 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@jammy:/home/x# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
root@jammy:/home/x#

Output of docker info:

root@jammy:/home/x# docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 1
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc version: v1.1.2-0-ga916309
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-41-generic
 Operating System: Ubuntu 22.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 3.834GiB
 Name: jammy
 ID: 4P6A:5SVW:L6L2:P6FD:BX3T:HQZQ:OJAA:AZPT:T2KK:QYRO:HXSF:GBGP
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.): Above is from Virtual Box. Also fails on Ubuntu:focal Also fails on physical server.

** Solution **

 docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d

Found on https://stackoverflow.com/questions/70757791/build-linux-arm64-docker-image-on-linux-amd64-host Found in blog https://www.docker.com/blog/multi-platform-docker-builds/

Should be placed in the main documentation other than docker desktop.

marcpawl avatar Jul 11 '22 22:07 marcpawl

Thanks for reporting! That's definitely something that should gain more visibility outside of Docker Desktop documentation.

Do you have some suggestions regarding the place in documentation where this information could be included? Is there a particular page where you expected to find such information? If you have a specific documentation change in mind, don't hesitate to contribute it to the docker.github.io repository.

Also, we could probably be able to detect it from the cli side to provide the user with a more meaningful message (and link to the documentation).

vvoland avatar Jul 12 '22 09:07 vvoland