Compiling the Go Application for Containers

Learn how to compile the application to run in Linux containers.

Overview

An alternative way to distribute your application that has become increasingly popular in recent years is allowing your users to run the application in Linux containers. Containers package your application and all the required dependencies using a standard image format, and they run the application in isolation from other processes running on the same system. Containers use Linux kernel resources such as Namespaces and Cgroups to provide isolation and resource management.

There are different container runtimes available, such as Podman and Docker. If you’re running these examples on a Linux system, you can use either one interchangeably. If you’re running on Windows or macOS, Docker provides a desktop version that makes it easier to start. You can also use Podman on these operating systems, but you need to install a Virtual Machine to enable it. But we don’t cover a container runtime installation process here. For more details, check the appropriate project documentation.

Get hands-on with 1200+ tech skills courses.