Docker lab/version note: use supported Linux-container tools and patched images. Check version compatibility before running the examples. Docker, Swarm and platform-specific deployment steps were not tested live.
What this guide covers
Apple Silicon uses ARM64 while many Intel and AMD servers use AMD64. A multi-platform image contains a version for each architecture so Docker can select the appropriate one.
Before you start
Use Linux containers, Docker Buildx and a registry you can push to. Build the Node.js application from the container guide. macOS containers here run in a Linux virtual machine, not on the macOS kernel.
Step 1: Check platform support
Run:
docker context show
docker buildx version
docker buildx ls
docker buildx imagetools inspect node:24-bookworm-slim
docker buildx create --name cross-lab --driver docker-container --use
docker buildx inspect --bootstrap
The base image must support both target architectures. The selected builder needs native nodes or configured emulation for the platforms it builds.
Step 2: Build and publish both variants
Run:
read -r -p 'Your registry/repository:release reference: ' MULTI_IMAGE
export MULTI_IMAGE
docker login
docker buildx build --builder cross-lab \
--platform linux/amd64,linux/arm64 \
--pull --tag "$MULTI_IMAGE" --push .
docker buildx imagetools inspect "$MULTI_IMAGE"
Enter your own registry/repository tag. --push publishes the multi-platform result. Do not copy node_modules from a Mac into a Linux image; install dependencies for the target environment.
Step 3: Test on each native platform
On an ARM64 Linux Docker environment, run:
: "${MULTI_IMAGE:?Set the published multi-platform reference}"
docker pull --platform linux/arm64 "$MULTI_IMAGE"
docker run --rm --platform linux/arm64 "$MULTI_IMAGE" \
node -p 'process.platform + "/" + process.arch'
On an AMD64 Linux Docker environment, run:
: "${MULTI_IMAGE:?Set the published multi-platform reference}"
docker pull --platform linux/amd64 "$MULTI_IMAGE"
docker run --rm --platform linux/amd64 "$MULTI_IMAGE" \
node -p 'process.platform + "/" + process.arch'
Also test actual application requests. Emulation is useful for some checks but is not a native performance test.
Check the result
Inspect the published manifest and verify both architecture entries. Native extensions and compiled binaries must match the target platform even when the source language is portable.
Conversation
0 commentsNo comments yet. Start the conversation below.