docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 291 forks source link

Docker multi-platform build fails using platform linux/arm64/v8 #14011

Open moises-addcomm opened 7 months ago

moises-addcomm commented 7 months ago

Description

Since version 4.26 there is no way to build a multi-platform build that uses the platform linux/arm64/v8. An error in qemu is thrown: 31.46 Setting up mount (2.37.2-4ubuntu3.4) ... 31.48 Processing triggers for libc-bin (2.35-0ubuntu3.6) ... 31.57 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Sub-process /usr/bin/dpkg returned an error code (1)

When I run it on a Mac, the build is built without problems

Reproduce

  1. Create a Dockerfile that uses the latest Ubuntu image
    
    FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yq RUN apt-get upgrade -yq

RUN apt-get autoremove -y

2. Execute this docker command in the path where the docker file is:

`docker buildx build --no-cache --progress=plain --platform linux/arm64/v8 --load .`

3. After some seconds this error is thrown:

[3/7] RUN apt-get upgrade -yq: 30.58 Unpacking libsmartcols1:arm64 (2.37.2-4ubuntu3.4) over (2.37.2-4ubuntu3) ... 30.78 Setting up libsmartcols1:arm64 (2.37.2-4ubuntu3.4) ... (Reading database ... 4387 files and directories currently installed.) 31.09 Preparing to unpack .../libuuid1_2.37.2-4ubuntu3.4_arm64.deb ... 31.12 Unpacking libuuid1:arm64 (2.37.2-4ubuntu3.4) over (2.37.2-4ubuntu3) ... 31.34 Setting up libuuid1:arm64 (2.37.2-4ubuntu3.4) ... 31.46 Setting up mount (2.37.2-4ubuntu3.4) ... 31.48 Processing triggers for libc-bin (2.35-0ubuntu3.6) ... 31.57 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Sub-process /usr/bin/dpkg returned an error code (1)

DockerfileUbuntu:10

8 | 9 | RUN apt-get update -yq 10 | >>> RUN apt-get upgrade -yq 11 | RUN apt-get install -yq software-properties-common tzdata openssl 12 | RUN apt-get install -yq apt-utils vim htop monit curl wget unzip zip

ERROR: failed to solve: process "/bin/sh -c apt-get upgrade -yq" did not complete successfully: exit code: 100

Expected behavior

The command docker buildx build should created the image on the platform selected. If it's run with this platforms --platform linux/amd64,linux/arm/v7 it's created properly.

docker version

Client:
 Cloud integration: v1.0.35+desktop.13
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:16:45 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Desktop
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:18:01 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    26.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.13.1-desktop.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.26.1-desktop.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.27
    Path:     /usr/local/lib/docker/cli-plugins/docker-debug
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /usr/local/lib/docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.23
    Path:     /usr/local/lib/docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     /usr/local/lib/docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.1.0
    Path:     /usr/local/lib/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:     /usr/local/lib/docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.6.3
    Path:     /usr/local/lib/docker/cli-plugins/docker-scout
WARNING: Plugin "/usr/local/lib/docker/cli-plugins/docker-scan" is not valid: failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-scan: no such file or directory

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 5
 Server Version: 26.0.0
 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: 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: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.15.146.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 15.49GiB
 Name: docker-desktop
 ID: a862ff02-d700-4207-9f0e-12d9d2decaa1
 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
 Labels:
  com.docker.desktop.address=unix:///var/run/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile

Diagnostics ID

52BFDE32-9FA6-4A91-AA13-11B3967F6A38/20240410215247

Additional Info

Running on Windows 11 under WSL2 with a Ubuntu 22.04

MountainKing123 commented 6 months ago

I have exactly the same problem. Also Windows 11, WSL 2 (Docker Desktop) and building from ubuntu for linux/arm64.

Get the same seg fault when dpkg is trying to configure libc-bin.

Since Arm64 arches are now very much recommended for modern server infrastructure, it would be nice to have this fixed asap or at least have a workaround.

MountainKing123 commented 6 months ago

Fyi, as a workaround, since I don't think this step should be required when running docker desktop (or it should be boldly marked in your cross compilation docs.): docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes

This should effectively pull multiarch/qemu-user-static, re-setup qemu-user-static with :latest to be properly installed and configured with binfmt, that comes wiith Docker desktop.

After this, running docker buildx build --platform linux/amd64,linux/arm64 <your_image_name> succeeds for both platorms and runnig docker run --rm --platform linux/arm64 <your_image_name> uname -m produces aarch64 as expected.

More on what this command does: https://stackoverflow.com/questions/72444103/what-does-running-the-multiarch-qemu-user-static-does-before-building-a-containe

If you believe I did something wrong on my end, or had wrong assumptiond, to run into this issue, please tell me. I'm still rather new to Docker :)

moises-addcomm commented 6 months ago

Thanks!! That workaround actually worked. Anyway, I think this still needs to be fixed.

crackedupcorson commented 4 months ago

This happened to me too - I was able to build a linux/arm64/v8 image on Windows Docker Desktop a few weeks back (for a personal project), and then today I wasn't able to. The linux/arm64/v8 platform was missing from the default builder, but not sure when it happened? I wonder if it was related to a Windows upgrade as I got one a few days ago. I publish the images to my own docker account, so could tie the uploads to a working combo of Windows & Docker Desktop if it helps?

windows_upgrade_timeline

working_upload 17 days ago (20th June)

I was on Docker Desktop 4.26, so I decided to upgrade to 4.31 and it didn't change it. Followed the commands and I was able to build my image.

I've attached a screenshot of the error message if it helps, can attach the full logs if it helps? My Docker Desktop sends usage statistics so I can give my account details if needed docker_desktop_arm64_error