The container binary or script cannot run on the current CPU architecture. This usually means an image built for a different architecture (e.g., ARM vs x86) or a script missing its shebang line.
This error occurs when Docker tries to execute a binary or script that is incompatible with the container runtime environment. The operating system cannot interpret the executable format. The most common cause is an architecture mismatch: trying to run an ARM64 image on an x86_64 host (or vice versa). This became more prevalent with Apple Silicon Macs (M1/M2/M3) which use ARM architecture.
Verify the image architecture matches your host:
# Check your host architecture
uname -m
# Check image architecture
docker inspect --format "{{.Architecture}}" <image_name>
# Or view manifest for multi-arch images
docker manifest inspect <image_name>Common architectures: amd64 (x86_64), arm64 (aarch64), arm/v7.
If the architecture does not match, pull the correct variant:
# Pull specific architecture
docker pull --platform linux/amd64 <image_name>
docker pull --platform linux/arm64 <image_name>
# Run with platform flag
docker run --platform linux/amd64 <image_name>Docker Desktop can emulate other architectures (slower but works).
If you control the image, build for multiple architectures:
# Enable buildx
docker buildx create --use
# Build for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 -t myimage:latest .This creates a manifest that works on both architectures.
If the error is about a script, ensure it has a proper shebang:
#!/bin/bash
# or
#!/bin/shThe shebang must be the very first line, with no spaces before it. Also verify the interpreter exists in the container.
Scripts created on Windows may have CRLF line endings. Convert them:
# Using dos2unix
dos2unix script.sh
# Or using sed
sed -i "s/\r$//" script.sh
# In Dockerfile, convert during build
RUN sed -i "s/\r$//" /entrypoint.shEnsure scripts are executable:
# In Dockerfile
COPY --chmod=755 entrypoint.sh /entrypoint.sh
# Or run chmod
RUN chmod +x /entrypoint.shApple Silicon Macs: Install Rosetta 2 for better x86 emulation: softwareupdate --install-rosetta. Docker Desktop uses QEMU for emulation, which is slower than native.
CI/CD Pipelines: If building on ARM runners (like GitHub Actions ARM), ensure you build multi-arch images or specify the correct platform.
Base Image Selection: Alpine-based images are smaller but may have different binary compatibility. If having issues, try a Debian-based image like node:20-slim instead of node:20-alpine.
image operating system "linux" cannot be used on this platform
How to fix 'image operating system linux cannot be used on this platform' in Docker
manifest unknown: manifest unknown
How to fix 'manifest unknown' in Docker
cannot open '/etc/passwd': Permission denied
How to fix 'cannot open: Permission denied' in Docker
Error response from daemon: failed to create the ipvlan port
How to fix 'failed to create the ipvlan port' in Docker
toomanyrequests: Rate exceeded for anonymous users
How to fix 'Rate exceeded for anonymous users' in Docker Hub