This document explains how to build Docker images that work on both Linux and Mac (including M1/M2/M3 Macs).
- Docker 19.03 or newer with buildx support
- Docker buildx plugin enabled
To build a Docker image for your current platform:
make docker-buildThis creates images with both names for backward compatibility:
docker.io/streamnative/mcp-server:latestdocker.io/streamnative/mcp-server:<git-version>docker.io/streamnative/snmcp:latest(legacy name)docker.io/streamnative/snmcp:<git-version>(legacy name)
To build images for both Linux (amd64) and Mac (arm64):
make docker-build-multiplatformTo build multi-platform images and push them to a registry:
make docker-build-pushYou can customize the build using environment variables:
# Use custom registry
DOCKER_REGISTRY=myregistry.io make docker-build-push
# Use custom image names
DOCKER_IMAGE=my-mcp-server DOCKER_IMAGE_LEGACY=my-snmcp make docker-build
# Build for specific platforms
DOCKER_PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7" make docker-build-multiplatformBy default, images are built for:
linux/amd64- Intel/AMD 64-bit processors (most Linux servers and older Macs)linux/arm64- ARM 64-bit processors (Apple Silicon Macs, ARM-based servers)
You can use either mcp-server or snmcp image names - they are identical:
# Using the new name
docker run --rm -it docker.io/streamnative/mcp-server:latest
# Using the legacy name (backward compatibility)
docker run --rm -it docker.io/streamnative/snmcp:latest# Using the new name
docker run --rm -it docker.io/streamnative/mcp-server:latest
# Using the legacy name (backward compatibility)
docker run --rm -it docker.io/streamnative/snmcp:latest# Using the new name
docker run --rm -it --platform linux/arm64 docker.io/streamnative/mcp-server:latest
# Using the legacy name (backward compatibility)
docker run --rm -it --platform linux/arm64 docker.io/streamnative/snmcp:latestFor backward compatibility, all builds create images with two names:
streamnative/mcp-server- The new, preferred namestreamnative/snmcp- The legacy name for backward compatibility
Both names point to the exact same image and can be used interchangeably.
If buildx is not available, enable it:
# Check if buildx is available
docker buildx version
# Create and use a new builder
docker buildx create --useIf you encounter issues, clean the buildx environment:
make docker-buildx-clean
make docker-buildx-setupThe Dockerfile accepts the following build arguments:
VERSION- Version string for the binaryCOMMIT- Git commit hashBUILD_DATE- Build timestamp
These are automatically set by the Makefile based on git information.
The Docker image:
- Runs as a non-root user (uid: 1000, gid: 1000)
- Uses minimal Alpine Linux base image
- Includes only necessary CA certificates for HTTPS connections
- Has a read-only root filesystem (can be enforced with
--read-onlyflag)
# Setup buildx (first time only)
make docker-buildx-setup
# Build multi-platform image (creates both mcp-server and snmcp tags)
make docker-build-multiplatform
# Run on current platform (using new name)
docker run --rm -it docker.io/streamnative/mcp-server:latest
# Run on current platform (using legacy name)
docker run --rm -it docker.io/streamnative/snmcp:latest
# Run with custom configuration
docker run --rm -it \
-v $(pwd)/config.yaml:/server/config.yaml:ro \
docker.io/streamnative/mcp-server:latest \
--config /server/config.yaml