exec /usr/local/bin/docker-entrypoint.sh: exec format error
or
standard_init_linux.go: exec user process caused: exec format error
The container is trying to execute a binary that doesnβt match the CPU architecture, or a script is missing its shebang line.
Fix 1: Platform mismatch (ARM vs. x86)
Most common on Apple Silicon (M1/M2/M3) Macs. The image was built for linux/amd64 but youβre running on linux/arm64.
# β Image built for wrong platform
docker run myimage
# β
Force the platform
docker run --platform linux/amd64 myimage
# β
Or build for the right platform
docker build --platform linux/arm64 -t myimage .
# β
Build for both
docker buildx build --platform linux/amd64,linux/arm64 -t myimage .
Fix 2: Missing shebang in entrypoint script
# β Script without shebang
echo "hello"
# β
Add shebang as first line
#!/bin/bash
echo "hello"
# β
Or for sh
#!/bin/sh
echo "hello"
Fix 3: Windows line endings
If you wrote the script on Windows, it might have \r\n line endings:
# Convert to Unix line endings
sed -i 's/\r$//' entrypoint.sh
# Or in Dockerfile
RUN sed -i 's/\r$//' /app/entrypoint.sh
Fix 4: Script not executable
# In Dockerfile
COPY entrypoint.sh /app/
RUN chmod +x /app/entrypoint.sh
See also: Docker cheat sheet | Docker image not found fix
Related: Docker vs Kubernetes