Earlier this year Docker announced a partnership with Arm enabling developers to build applications for server, cloud, edge, and IoT environments seamlessly on the latest Arm architecture.
With the latest Docker Desktop (edge version) you can now quickly and easily build multi-arch docker images for x86_64, arm/v6, arm/v7 and arm64.
Get Started by Installing Docker Desktop CE Edge version
Updated: New install instructions for Docker Desktop version 22.214.171.124
“Docker Desktop CE” can be found on Docker Hub.
If you follow the normal download links will not find the “Edge” version.
First go to Docker Hub create an account and login.
Next do a search for “desktop” and go to the “Docker CE” page.
Select the version for Mac or Windows. (The following will be for the Mac version)
Scroll down until you see the “Get Docker for Mac (Edge)” button.
Download and install. This should be version 126.96.36.199 or later.
Previously the “experimental features” were enabled by default but this is no longer true and will they need to be enabled.
Open “Preferences” (Settings)
Go to “>_ Command Line” , turn on “Enable experimental features” then “Apply & Restart”.
“Docker Desktop” is now ready to go.
Before trying to build a multi-arch docker image we first need to make sure that everything we are trying to build is available for the platform and arch types that we want to build for.
This includes not only the platform and the primary content but also all the dependencies that need to be installed.
In this example we want to create a docker container for Swift on Linux Ubuntu 18.04 that will run on x86_64, arm64/aarch64 and armv7. This means we will need Swift install packages for x86_64, arm64/aarch64 and armv7.
Open Source Swift on Linux
The official Swift releases are only available for x86_64 and in “tar.gz” format which means we need to create .deb install packages and add the other arch types in an easy to use package repository. By using
sudo apt install we can simplify the docker file.
Swift Package Repository
I have created a package repository and built all the Swift install packages needed for x86_64, arm64 and armv7 on Ubuntu 18.04 and 16.04.
There are 2 types of package available for use with Swift docker containers.
swiftlang-core — This contains only the Swift core libraries, Foundation and LibDispatch.
swiftlang-dev — This is the full Swift release with all Dev tools such as SPM, XCTest, LLDB etc.
In this example we will use the full swiftlang-dev package.
The Package Repository is available here ~ Swift-Arm/Docker
With Docker Desktop installed and the Swift repository ready we can start building our multi-arch images.
Using the Swiftlang-Docker Sample on GitHub
Docker Multi-Arch (x86_64 / AArch64 / Armv7) Image packaging for Swift.
Open a Terminal Window
Download and open the swiftlang-docker example repository.
The Docker File
The docker image will be build from Ubuntu 18.04. In line 25 we add the Swift install repository and in line 27 we add Swift to the container image. The repository will automatically select the correct arch type for all the the arch types we include in the docker build command.
Using the new “buildx” command in Docker Desktop
docker buildx --help to see available commands
The default docker builder does not support multi-arch so we will need to create a new builder and tell docker to use it.
Use the platform tag add the different arch types to the image -
Terminal output should like similar to this …
Testing the Docker Image
Pre-built images are available on Docker Hub.
Open a terminal on your server.
Testing on AWS x86_64 server ~ t2.large
Testing on AWS arm server ~ a1.xlarge
Testing on Raspberry Pi 4
The new Docker Desktop enables us to build a single docker image from a single docker file that is compatible with multiple systems and arch types.
Docker Desktop for Mac and Windows | Docker
Learn why Docker Desktop is the preferred choice for millions of developers building containerized applications…
Docker Hub /futurejones/swiftlang
Docker Multi-Arch Image packaging for Swift. Contribute to futurejones/swiftlang-docker development by creating an…
Swift-Docker Package Repository
swift-arm/docker - Packages · packagecloud
Swift-Arm for Docker *There are 2 packages available for use with Swift-Arm docker containers.* **swiftlang-core** …
Docker Basics for Amazon ECS
Thanks to Packet.net, WorksOnArm and PackageCloud for their support of the Swift on Arm project.