AWS Open Source Blog
Announcing Finch on Linux for Container Development
In 2022 AWS announced Finch, an open source command line developer tool for building, running, and publishing Linux containers on macOS. Within a year in November 2023, Finch successfully reached its 1.0 milestone for general availability (GA). Since then, we’ve expanded support from macOS to also include Windows and made virtualization framework (vz
) the default vmType
option, when it’s available.
Today, we are excited to announce that Finch now supports Linux in addition to Windows and macOS. With the addition of Linux support, Finch now provides a consistent container development experience across all major operating systems, making it easier for developers to run familiar Finch commands to build, run, and publish their containers.
On Linux, Finch supports the same core functionality as on other platforms, including:
- Building container images using Dockerfiles
- Running containers locally
- Pushing and pulling container images to registries
- Managing container networks and volumes
- Composing multi-container applications using
finch compose
As seen with the previous releases, Finch on Linux is built on top of open source components like nerdctl, containerd and BuildKit. This ensures a consistent, vendor neutral experience across platforms.
Finch on macOS and Windows uses an intermediate component Lima. Through Lima, Finch uses virtualization technology (QEMU or Virtualization Framework on macOS; WSL2 on Windows). This allows Finch to access the necessary Linux primitives, such as namespaces, which are required for containerization technology.
On Linux, Finch can directly utilize fundamental Kernel capabilities such as namespaces and cgroups to interact with low level components such as nerdctl and containerd without having to use an intermediary virtualization layer.
Walkthrough
Finch can be installed on Linux in two ways:
- By leveraging a readily available RPM package on Amazon Linux 2 and Amazon Linux 2023 (or)
- By leveraging build scripts to generate newer RPM packages for your target Linux distribution of choice.
In this walkthrough, Finch is installed on an Amazon Linux 2023 based Amazon Elastic Compute Cloud (Amazon EC2) instance.
Step-1: Installing Finch
On Amazon Linux Distribution:
Finch on Linux is packaged as RPMs for Amazon Linux 2 (AL2) and Amazon Linux 2023 (AL2023). These packages are available in the Yellowdog Updater Modified (YUM) configured package repositories and can be installed using the following command:
sudo yum install runfinch-finch
This will install the Finch binary and all necessary dependencies. For more details on the latest RPM package for Amazon Linux, please refer to the release notes on the Finch CLI GitHub repository.
Enable the services to start automatically on system boot and start it immediately:
Finch on Linux can make use of some optional components, such as SOCI snapshotter and the ECR Credential Helper. On other Finch platforms, these components are installed at runtime, which works well for platforms where Finch has its own isolated VM environment. However, on a shared system, the runtime management of system dependencies can be more challenging. These components must be installed and configured manually on Linux at this time. For instructions on installing and configuring the optional Finch components on Linux, please refer to the official Finch documentation.
On Non-Amazon Linux Distributions:
In addition to the RPM packages, the Finch GitHub repository includes scripts for building RPMs from source. This allows users of all other Linux distributions, such as Fedora, to try out Finch, as long as their package management system is RPM-based.
To install Finch on non-Amazon Linux distributions, please refer to the project documentation.
Step-2: Verifying the functionality
As a way to validate the functionality of Finch, you can run a simple container. The run
command will pull the image if it’s not already present, create a new container instance, and start it. To automatically remove the container after the command execution is completed, include the --rm
flag, suitable for testing purposes.
Step-3: Building Multi-Platform Images
Linux supports user-space emulation, which allows you to run containers built for different CPU architectures. However, QEMU’s user-mode emulation is not enabled by default on Linux systems. This means you can only build container images for the host CPU architecture platform, which could be AMD64 (x86_64) or ARM64.
To verify that we are running our commands on an AL2023 AMD64 Linux instance, we can run uname -sm
and see the architecture listed as AMD64:
uname -sm Linux x86_64
We can run an AMD64 container, providing a start up command to illustrate the same architecture:
Now, let’s install QEMU manually for cross-platform support. The tonistiigi/binfmt
image provides an easy way to install QEMU and register the executable types on the host with a single command.
sudo finch run --privileged --rm tonistiigi/binfmt --install all
Refer to the documentation for prerequisites.
Let’s verify that the executable types are registered on the host operating system with this command:
ls -1 /proc/sys/fs/binfmt_misc/qemu-*
When QEMU is properly installed, you should see output like this:
Once the user-space emulation is enabled, we can create and run an ARM64 container using the --platform
option to specify the non-native architecture:
This enables us to build multi-platform images using Finch and also run containers on non-native architectures. Using emulation requires no changes to your Dockerfile, and BuildKit automatically detects the architectures that are available for emulation.
By default, Finch would build for the host’s CPU architecture platform. Instead of AMD64, to build an ARM64 image, we can add the --platform
flag to our command:
Clean Up
To clean up the stack, complete the following actions:
1. Remove container images built in the walkthrough using the following command:
sudo finch rmi public.ecr.aws/test/finch-multiarch:latest
2. Remove installed copies of Finch using the following command:
sudo yum remove runfinch-finch
Terminate any Amazon EC2 instances created for this walkthrough.
Conclusion
This blog post covered how you can install and run Finch on Linux, including the ability to run containers on cross-architecture platforms and build multi-platform container images. We encourage you to try out Finch and let us know about your experiences. Join the Finch community by starting a discussion, reporting any issues you encounter, or contributing code on our GitHub repository. We’re eager to evolve Finch with input from developers like you, so we invite you to be a part of shaping the future direction of this project.