AWS Announces Finch for Linux, Bringing Cross-Platform Container Dev

October 15, 2024

Amazon Web Services (AWS) has exciting news for developers who work across multiple operating systems: Finch, the open-source command line developer tool, now supports Linux, in addition to macOS and Windows. Initially launched in 2022 as a tool exclusively for macOS, Finch quickly gained traction and reached its general availability milestone in November 2023. With Linux support now added, developers across all major platforms can enjoy a seamless container development experience. This update signifies a major step forward in enabling a consistent workflow for developers, who can now utilize familiar Finch commands to build, run, and publish containers across different operating systems.

Finch supports essential container functionalities such as building container images using Dockerfiles, running containers locally, and managing container networks and volumes. Thanks to its reliance on open-source components like nerdctl, containerd, and BuildKit, Finch offers a vendor-neutral experience. On macOS and Windows, Finch leverages Lima, an intermediate component that uses virtualization technologies like QEMU or WSL2. On Linux, Finch can interact directly with kernel capabilities without the need for an intermediary virtualization layer. AWS’s commitment to open-source innovation is evident in Finch’s development, and the expansion to Linux underscores AWS’s dedication to providing tools that are both versatile and easy to use across multiple platforms.

1. Setting Up Finch

To set up Finch on an Amazon Linux distribution, you can take advantage of the readily available RPM packages tailored for Amazon Linux 2 (AL2) and Amazon Linux 2023 (AL2023). These packages simplify the installation process through YUM-configured package repositories. By running the following command, you can install Finch along with all its required dependencies:

sudo yum install runfinch-finch

This command fetches and installs the Finch binary and the necessary supporting libraries. For the most recent updates and details on the latest RPM packages, you can always refer to the release notes available on the Finch CLI GitHub repository. This repository provides comprehensive information about newly added features, bug fixes, and other updates that enhance the tool’s functionality and user experience.

Once Finch and its dependencies are installed, you should enable the supporting services to start automatically upon system boot. This ensures that your container development environment is ready to use immediately after the system starts. Use the following commands to enable and start these services:

sudo systemctl enable --now containerd.servicesudo systemctl enable --now finch.servicesudo systemctl enable --now finch-buildkit.servicesudo systemctl enable --now finch-buildkit.socket

These commands ensure that containerd, Finch, BuildKit, and the BuildKit socket are all operational and automatically initiated at system startup. Having these services enabled is crucial for maintaining a seamless and efficient development workflow, eliminating the need for manual start-up procedures every time you reboot or start your system.

2. Confirming the Installation

To ensure that Finch has been installed correctly and is functioning as expected, it is a good practice to run a simple container. This initial test will help you verify that the tool can pull the necessary images, create a new container instance, and start it without any issues. For this purpose, you can use the following command:

sudo finch run --rm public.ecr.aws/finch/hello-finch

The use of the --rm flag in this command is particularly useful for testing because it ensures that the container is automatically removed after the command execution is completed. This feature helps keep your system clean and frees up resources that would otherwise be occupied by leftover testing containers.

Running this command will initiate a series of actions: if the specified image is not already present on your system, Finch will pull it from the Amazon Elastic Container Registry (ECR) public repository. Once the image is available, Finch will create a new container instance from it and start the container. This simple and effective test provides a clear indication that Finch is correctly installed and capable of executing fundamental container operations, such as pulling and running container images.

3. Creating Multi-Platform Images

Linux supports user-space emulation, which allows running containers built for different CPU architectures. However, it is important to note that QEMU’s user-mode emulation is not enabled by default on Linux systems. Typically, you can build container images only for the host CPU architecture, such as AMD64 (x86_64) or ARM64. To verify the architecture currently being used on your system, you can run the following command:

uname -sm

For instance, executing this command on a standard AMD64 (x86_64) architecture system will produce output indicating that the architecture is AMD64. Further, you can run an AMD64 container to confirm this architecture by using:

sudo finch run --rm --platform=linux/amd64 public.ecr.aws/amazonlinux/amazonlinux uname -sm

To add cross-platform support and enable the building of container images for different CPU architectures, you need to install QEMU manually. The tonistiigi/binfmt image facilitates this process, allowing for easy installation and the registration of executable types on the host system. Use the following command to install QEMU:

sudo finch run --privileged --rm tonistiigi/binfmt --install all

Once QEMU is installed, you can verify its proper installation by listing the registered executable types:

ls -1 /proc/sys/fs/binfmt_misc/qemu-*

When QEMU is installed correctly, you should see outputs indicating the registration of various executable types, such as qemu-aarch64 and qemu-arm. With user-space emulation enabled, you can now create and run containers for different architectures. For instance, you can run an ARM64 container using:

sudo finch run --rm --platform=linux/arm64 public.ecr.aws/amazonlinux/amazonlinux uname -sm

This capability allows you to build multi-platform images and run containers on architectures that are not native to your host system, expanding the versatility of your development environment.

4. Tidying Up

After you are done with your development and testing activities, it is essential to clean up the setup to free up system resources and remove unnecessary files. Start by removing any container images that were built during the walkthrough. Use the following command:

sudo finch rmi public.ecr.aws/test/finch-multiarch:latest

This command removes the specified container image from your system, helping to maintain a clean working environment. Next, you can uninstall Finch using the following command:

sudo yum remove runfinch-finch

Uninstalling Finch removes the tool and associated dependencies, ensuring that no residual files remain. If you used an Amazon EC2 instance for this walkthrough, make sure to terminate any instances that were created, thereby avoiding unnecessary charges and resource consumption on your AWS account.

Cleaning up your environment is an important final step to ensure that your development workspace remains organized and efficient, especially if you plan to work on multiple projects or switch between different tools and technologies frequently.

Conclusion

This article has walked you through the essential steps to install and run Finch on a Linux system. From initially setting up the tool and verifying its installation to generating multi-platform images and maintaining a clean development environment, we’ve covered all the basics. These practical guidelines ensure you can maximize Finch’s potential, leveraging its cross-platform capabilities and robust container image-building features.

AWS’s introduction of Linux support for Finch highlights their dedication to offering versatile and powerful tools for developers who work across various operating systems. By adhering to these steps, developers can streamline their container development workflows, leading to improved consistency and efficiency in their projects.

Furthermore, the support for multi-platform images significantly broadens the range of environments where your applications can run, making your development process more flexible and productive. Cleaning up your environment as you go ensures that your system remains organized, reducing the risk of conflicts or redundant files slowing you down.

In conclusion, following this comprehensive guide will enable you to fully harness the capabilities of Finch, allowing for a more streamlined and effective container development experience. These steps not only make your work smoother but also elevate the overall quality and reliability of your software development projects.

Subscribe to our weekly news digest.

Join now and become a part of our fast-growing community.

Invalid Email Address
Thanks for subscribing.
We'll be sending you our best soon.
Something went wrong, please try again later