August 24, 2021·4 min read·engineeringswiftdockerlinuxtooling

Swift nightly Docker images add native AArch64 toolchains

Official development snapshot images now cover AArch64 on three Linux distributions. Their Dockerfiles show how architecture selection, archive layout and signature verification make the compiler available inside the image.

A container tag is useful only if the image behind it contains software for the machine running it. Swift's August 24 announcement adds AArch64 development snapshots to the project's nightly Docker images. The supported combinations are Ubuntu 20.04, CentOS 8 and Amazon Linux 2. The announcement demonstrates each image reporting an aarch64-unknown-linux-gnu target.

This expands access to the development compiler without requiring every interested user to assemble a toolchain environment independently. The scope is nightly development snapshots. It does not establish that all stable Swift image tags now support ARM, or that a development snapshot has become a supported stable release.

I like being able to investigate a language change without first making toolchain installation a separate project. Swift's build times already make iteration an area where friction matters to me. A published native image provides a more direct starting point for examining the compiler on another Linux architecture.

The image selects a toolchain for its target architecture

The Ubuntu buildx Dockerfile available today makes the architecture handling explicit. It defines separate base stages for amd64 and arm64, then selects a stage through TARGETARCH. The arm64 stage adds an AArch64 suffix to the toolchain platform name.

That suffix affects the download location and the expected archive name. The image construction does not take an x86 compiler and make it suitable for ARM by placing it in a different base image. It downloads the development toolchain associated with the selected platform. The compiler and its surrounding Linux dependencies must agree on the environment being assembled.

The Dockerfile also changes archive extraction options between the two stages. The amd64 path strips one leading archive component, while the arm64 path does not. A source comment refers to SR-14872 as the reason for adjusting those options. The important implementation fact is that installation layout is architecture-specific at this point. Using identical extraction arguments for both archives would disregard that documented difference.

These details explain why publishing another architecture involves more than adding a label to an image. The build must choose the right artifact and unpack it into a usable layout. A successful image build then needs evidence that the installed executable actually runs, which the Dockerfile obtains by invoking swift --version.

Development metadata chooses the snapshot

The build reads latest-build.yml from the appropriate development platform directory. It extracts the toolchain archive and signature names, derives the download directory and records the selected snapshot in .swift_tag. This allows a shared build definition to follow development snapshots while preserving an indication of which one it installed.

The resulting nightly tag represents a moving development channel. The Dockerfile's use of latest-build metadata is the concrete reason not to treat that name as a fixed compiler version. A later rebuild can resolve to another archive even when the Dockerfile itself is unchanged. For an investigation of compiler behavior, the version and snapshot identity are therefore useful evidence alongside the image tag.

The source places operating-system dependencies before the toolchain download. Its comment explains that these earlier steps should cache between Swift versions when the dependencies change little. The layering reflects two different rates of change. Linux prerequisites can remain the same while the development compiler advances.

This is useful for the image maintainers as well as consumers. The architecture-specific portion can vary artifact selection without duplicating the complete package installation logic. At the same time, the explicit stages leave room for the archive differences that currently exist. Sharing build instructions does not require pretending that both toolchain archives have the same packaging.

Download verification is part of installation

After choosing the toolchain, the Dockerfile downloads its detached signature and imports Swift's published signing keys. It invokes GPG verification before extracting the archive. Those steps are part of building the image, not commands every consumer must reconstruct after starting a container.

The verification statement concerns the downloaded toolchain artifact. It should not be expanded into a claim that every component in the base distribution has been independently audited. The source shows a specific sequence for authenticating the compiler archive and then removing temporary verification material and downloads.

The CentOS build definition and Amazon Linux definition follow the same architecture-stage pattern. Their package installation uses the respective distribution environment. This gives users several native Linux environments while keeping the toolchain selection mechanism recognizable across them.

The first command establishes what was obtained

The announcement supplies a small command for checking the Ubuntu image. This spelling also removes the container after it exits.

docker run --rm swiftlang/swift:nightly-focal bash -c "swift --version"

On the announced AArch64 image, the published output identifies a Swift development compiler and the AArch64 Linux target. That is the appropriate first observation before attributing a compilation result to a particular toolchain. It distinguishes the compiler actually installed from assumptions made from a tag name.

Running the compiler version command is deliberately narrower than compiling an application. It establishes that the toolchain executable starts and reports its identity. An application with native dependencies still brings its own compatibility questions. The new distribution channel reduces toolchain setup work, while the application remains responsible for the libraries and build inputs it requires.

The repository's existing usage documentation separately describes slim runtime images that omit the compiler. That distinction remains relevant when choosing an image for experimentation. Inspecting a development compiler requires a toolchain image. A smaller image intended only to execute an already built program serves a different purpose and cannot supply the omitted compiler command.

I regard this as an improvement to participation in Swift development. ARM Linux users now have published nightly images for the named distributions, with the selection and verification steps visible in source. That makes compiler feedback more concrete because a report can identify the development snapshot and native target involved. The available images provide a defined environment for that work without claiming stability for the development compiler they contain.