Docker Buildx
Neil Haddley • March 1, 2021
Build multi-platform Docker images.
Buildx allows a developer to build for multiple architecture/operating systems.
When you invoke docker buildx build, you can set the --platform flag to specify the target platform for the build output, (for example, linux/amd64, linux/arm64, linux/arm/v7,linux/arm/v6, darwin/amd64).
The Dockerfile
Visual Studio Code is able to add a Dockerfile to the graphql-server project automagically.
I opened the Command Palette (⇧⌘P) and used the "Docker: Add Docker Files to Workspace..." command:

I selected Docker: Add Docker Files to Workspace...

I selected Node.js as the Application Platform

I selected the project's package.json file

I specified the port that the image would listen on

I chose not to add the Docker Compose file

I built the Docker image

The image was built and uploaded to Docker Desktop

I created a new container based on the new image (port 5000)

The container was running

I tested the image using Docker Desktop
Uploading to Dockerhub
BASH
1$ docker login --username=haddley 2 3$ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --rm -t haddley/graphql-server:latest --push .

I built the image for multiple Operating Systems/Processors

The image was uploaded to Docker Hub

I reviewed the Multiple OS/ARCH options
Docker playground
I added a new instance.
BASH
1docker run -d -p 5000:5000 haddley/graphql-server

I ran docker run -d -p 5000:5000 haddley/graphql-server

I accessed the image running in the lab
Raspberry Pi
The docker image can be run on a Raspberry Pi.

I ran the haddley/graphql-server image

I reviewed GraphiQL intellisense

The GraphQL service was running on the Raspberry Pi