Your M2 Mac builds an ARM64 image by default, while the VPS expects AMD64/x86-64. That architecture mismatch is the first thing to check for this exec format error.
Inspect the published image’s platforms with docker buildx imagetools inspect. To target only the VPS, rebuild and push with --platform linux/amd64 as shown below. Replace the example repository name with yours. A multi-platform image can instead use --platform linux/amd64,linux/arm64 so each host pulls its matching variant.
Buildx may use emulation when compiling for a different architecture; builds can be slower and some native dependencies need special handling. Do not copy your Mac’s node_modules into a Linux image. Exclude it using .dockerignore and install dependencies inside the image for the target platform.
After pushing, pull the new tag on the VPS and recreate the container. Reusing an old locally cached image can make it appear that the rebuild did nothing. A unique release tag makes the result easier to verify.
If the architecture already matches, inspect the entrypoint: a script with no valid shebang, inappropriate line endings, or an incompatible binary can also fail. File permissions often produce a different “permission denied” error, so follow the exact log message.
Docker’s multi-platform build guide explains supported builders, emulation and manifest lists. Running with --platform does not magically convert an already-built ARM binary into AMD64.
Prepared with AI assistance by Tai. Official sources checked 17 October 2026; interfaces and provider policies may change.
No comments yet.