Fix Raspberry Pi Docker Exec Format Errors¶
If Docker reports no matching manifest, check whether the image tag offers the platform Docker requested. If the image is present and starting the container reports exec format error, inspect the executable or script that the container starts. An ARM64 image can still contain an x86-64 executable copied during the build.
1. Check the platform that Docker needs¶
For a local Docker Engine on Raspberry Pi OS, run these commands on the Pi.
On a Pi 4B with 64-bit Raspberry Pi OS, uname -m reported aarch64 and dpkg reported arm64. The corresponding Linux container platform is linux/arm64. For a 32-bit install, check the exact requested variant from Docker, such as linux/arm/v7. uname -m describes the kernel. If your Docker context points to another machine, use the Server section of docker version and the requested platform for that engine. Docker multi-platform images, OCI platform variants
If the request is unexpected, check the command's --platform, any Compose platform: value, and the DOCKER_DEFAULT_PLATFORM environment variable. These settings can affect which image is requested. Compose platform setting
2. For no matching manifest, inspect the image tag¶
Use the exact tag that failed. The manifest command reads registry metadata without starting a container. It can also run when your shell has no access to the Docker daemon.
Look at the platform entries for os, architecture and any variant. The example tag listed linux/amd64 and linux/arm64 when inspected from the Pi 4B. If Docker requests linux/arm/v7, use a tag that publishes a compatible 32-bit ARM build, or move the project to a supported 64-bit OS if your hardware and applications allow it. For an image you maintain, build and publish it for the Pi's platform. Docker manifest inspection, Raspberry Pi OS image choices
3. For exec format error, inspect the program that starts¶
Check the Dockerfile's ENTRYPOINT and CMD, plus any Compose entrypoint or command that overrides them. Check which files the build copied and whether a bind mount supplies a different executable at the same path. The registry manifest describes the image's declared platform.
Run these on the executable you package, using the path to your build artifact. readelf is available in the binutils package on Raspberry Pi OS.
For native linux/arm64, an ELF executable should report AArch64 under Machine. In the Pi 4B test, both the native executable and the copied x86-64 sample reported ELF64. The Machine field distinguished them, and the x86-64 sample returned Exec format error. Build the application for the target architecture and rebuild the image with that artifact. Raspberry Pi Docker build and CI guide
If the entrypoint is a script, inspect the first line. For a POSIX shell script run directly, a common first line is #!/bin/sh, with that interpreter available in the image.
A directly executed test script without a shebang also returned Exec format error on the Pi 4B. The sed output makes a trailing \r visible if the file has Windows line endings. Save it with Unix line endings and check the interpreter inside the image. Linux executable and interpreter errors