Rosetta Emulation Breaks --platform linux/amd64 Containers on Apple Silicon with Docker Desktop #658

Open
opened 2025-12-29 01:24:17 +01:00 by adam · 1 comment
Owner

Originally created by @choseenonee on GitHub (May 19, 2025).

When the "Use Rosetta for x86_64/amd64 emulation on Apple Silicon" option is enabled in Docker Desktop (see screenshot below), some --platform linux/amd64 containers fail to start with the error:

exec /bin/bash: exec format error

Example:

docker run -it --rm --platform linux/amd64 swift:5.3 bash -c 'echo "print(\"hello world\")" > /tmp/test.swift && cd /tmp && swiftc test.swift && ./test'

Expected behavior:
The container should execute normally and output hello world.

Actual behavior:
The container fails with:

exec /bin/bash: exec format error

Workaround:
When I disable the Rosetta emulation option in Docker Desktop and retry the same command, it works correctly and the container runs as expected.

Screenshot of Option:
Image


System Info

  • Device: MacBook Pro with Apple Silicon (M1)
  • OS: 15.4.1 (24E263)
  • Rosetta Emulation Enabled: Yes (see screenshot)
  • Container Platform: linux/amd64
  • Example Image: swift:5.3

Docker version command output
Client:
Version: 28.1.1
API version: 1.49
Go version: go1.23.8
Git commit: 4eba377
Built: Fri Apr 18 09:49:45 2025
OS/Arch: darwin/arm64
Context: desktop-linux

Server: Docker Desktop 4.41.2 (191736)
Engine:
Version: 28.1.1
API version: 1.49 (minimum version 1.24)
Go version: go1.23.8
Git commit: 01f442b
Built: Fri Apr 18 09:52:08 2025
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0


How to Reproduce

  1. Enable Rosetta emulation in Docker Desktop.

  2. Run:

    docker run -it --rm --platform linux/amd64 swift:5.3 bash -c 'echo "print(\"hello world\")" > /tmp/test.swift && cd /tmp && swiftc test.swift && ./test'
    
  3. Observe error.

  4. Disable Rosetta and run the same command — it works.


Logs and Diagnostics

Please let me know if logs or diagnostics are needed. I've tested this on 3 macs (with identical macOS versions and different docker desktop versions)

Originally created by @choseenonee on GitHub (May 19, 2025). When the **"Use Rosetta for x86\_64/amd64 emulation on Apple Silicon"** option is enabled in Docker Desktop (see screenshot below), some `--platform linux/amd64` containers fail to start with the error: ``` exec /bin/bash: exec format error ``` Example: ```bash docker run -it --rm --platform linux/amd64 swift:5.3 bash -c 'echo "print(\"hello world\")" > /tmp/test.swift && cd /tmp && swiftc test.swift && ./test' ``` **Expected behavior:** The container should execute normally and output `hello world`. **Actual behavior:** The container fails with: ``` exec /bin/bash: exec format error ``` **Workaround:** When I disable the **Rosetta emulation** option in Docker Desktop and retry the same command, it works correctly and the container runs as expected. **Screenshot of Option:** <img width="817" alt="Image" src="https://github.com/user-attachments/assets/651a3d43-af61-419e-84f8-61101d1e5e3d" /> --- ### System Info * **Device:** MacBook Pro with Apple Silicon (M1) * **OS:** 15.4.1 (24E263) * **Rosetta Emulation Enabled:** Yes (see screenshot) * **Container Platform:** `linux/amd64` * **Example Image:** `swift:5.3` **Docker version command output** Client: Version: 28.1.1 API version: 1.49 Go version: go1.23.8 Git commit: 4eba377 Built: Fri Apr 18 09:49:45 2025 OS/Arch: darwin/arm64 Context: desktop-linux Server: Docker Desktop 4.41.2 (191736) Engine: Version: 28.1.1 API version: 1.49 (minimum version 1.24) Go version: go1.23.8 Git commit: 01f442b Built: Fri Apr 18 09:52:08 2025 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.7.27 GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da runc: Version: 1.2.5 GitCommit: v1.2.5-0-g59923ef docker-init: Version: 0.19.0 GitCommit: de40ad0 --- ### How to Reproduce 1. Enable **Rosetta emulation** in Docker Desktop. 2. Run: ```bash docker run -it --rm --platform linux/amd64 swift:5.3 bash -c 'echo "print(\"hello world\")" > /tmp/test.swift && cd /tmp && swiftc test.swift && ./test' ``` 3. Observe error. 4. Disable Rosetta and run the same command — it works. --- ### Logs and Diagnostics Please let me know if logs or diagnostics are needed. I've tested this on 3 macs (with identical macOS versions and different docker desktop versions)
Author
Owner

@brrock commented on GitHub (Jul 14, 2025):

Use apple containers natively

@brrock commented on GitHub (Jul 14, 2025): Use apple containers natively
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#658