Docker container does not run on macOS

I’m building the most basic container and trying to run it on macOS Big Sur 11.4 (Intel i9 processor). Docker Desktop version is 3.4.0 (3.4.0.5223). The Dockerfile has only:

FROM i386/ubuntu:18.04

Running docker build -t test:v1 . finished successfully.
However running the container: docker run test:v1 produced the following error:

WARNING: The requested image’s platform (linux/386) does not match the detected host platform (linux/amd64) and no specific platform was requested

You built a Docker Image for the i386 CPU architecture, which is not compatible with the amd64 of your host machine. The only time you can go across architectures is when running amd64 on the new Mac M1 chips. I believe there is some sort of emulation layer there. Otherwise, you need to run the correct image for your CPU architecture.

It seems that repository is specifically ONLY for i386 cpu architecture. If you just want to run Ubuntu locally, use the Official image for Ubuntu.

Here is a Dockerfile you can use to do what you want

FROM ubuntu:18.04

And then build for multiple architectures with this command

docker buildx create --use
docker buildx build --platform linux/amd64,linux/386 . -t test:v1

Now you can run docker run test:v1 on both your local machine and on remote i386 architectured CPUs.

2 Likes