Notes on Docker development and speed on Apple Silicon platforms

Apple builds on linux/arm64/v8, however, Linux production clusters run linux/amd64

This means you can’t save an image from Apple Silicon and push it to the cloud.

A “fix” is to export DOCKER_DEFAULT_PLATFORM=linux/arm64/v8, however this will make containers insanely slow on development Apple Silicon, so do not this globally (in ~/.zprofile).

You want images to be built using the native platform, whenever possible.

Build for specific platform directly:

docker build -t "eu:amd64" --platform=linux/amd64 .

Conclusion

Build on local machines using Dockerfile and docker-compose!

If, in emergency, you require pure image deployment, set variable when building, ie

export DOCKER_DEFAULT_PLATFORM=linux/amd64 && docker-compose up –build


Tags: