Podman is a container runtime that offers functionalities similar to Docker. It’s a part of the libpod library, enabling users to manage pods, containers, container images, and container volumes. Unlike Docker, which uses a client-server architecture and requires a daemon, Podman runs without a daemon and can operate without root privileges.
Introduction
This tutorial will guide you through manually installing Podman from the source code on an Ubuntu server. We will cover the installation of all necessary dependencies, including conmon (container monitoring), CNI (Container Network Interface) plugins, and Runc, the OCI-compliant runtime.
Prerequisites
- Ubuntu 18.04 server
- Root privileges
Installation Overview
- Install Dependencies
- Download Additional Configurations
- Install Conmon (Container Monitoring)
- Install CNI (Container Network Interface) Plugins
- Install Runc OCI Container Runtime
- Install Podman
Step 1 – Install Dependencies
We will start by installing Go and various package dependencies required to build Podman and other packages from the source.
First, update your Ubuntu repositories and upgrade your system:
sudo apt update sudo apt upgrade
Then, install Go and all package dependencies using the following command:
sudo apt install -y btrfs-tools git golang-go go-md2man iptables libassuan-dev libdevmapper-dev libglib2.0-dev libc6-dev libgpgme-dev libgpg-error-dev libprotobuf-dev libprotobuf-c-dev libostree-dev libseccomp-dev libselinux1-dev pkg-config
Step 2 – Download Additional Configuration
Create the containers directory ‘/etc/containers’ and download necessary configuration files to it:
sudo mkdir -p /etc/containers sudo curl https://raw.githubusercontent.com/projectatomic/registries/master/registries.fedora -o /etc/containers/registries.conf sudo curl https://raw.githubusercontent.com/containers/skopeo/master/default-policy.json -o /etc/containers/policy.json
registries.conf defines container image registries, allowing Podman to retrieve and download container images.
policy.json is part of the ‘skopeo’ project and is used for various operations on container images and repositories.
Step 3 – Install Conmon (Container Monitoring)
Conmon monitors containers by handling logging, serving attachments, and detecting OOM (Out of Memory) situations.
Create a Go project directory and download the CRI-O source code:
export GOPATH=~/go mkdir -p $GOPATH git clone https://github.com/kubernetes-sigs/cri-o $GOPATH/src/github.com/kubernetes-sigs/cri-o cd $GOPATH/src/github.com/kubernetes-sigs/cri-o
Build and install the conmon utility:
mkdir bin make bin/conmon sudo install -D -m 755 bin/conmon /usr/libexec/podman/conmon
Verify conmon installation:
/usr/libexec/podman/conmon --help
Step 4 – Install CNI (Container Network Interface) Plugins
Download and build CNI plugins from the source:
git clone https://github.com/containernetworking/plugins.git $GOPATH/src/github.com/containernetworking/plugins cd $GOPATH/src/github.com/containernetworking/plugins ./build_linux.sh
Move CNI binaries to the appropriate directory:
sudo mkdir -p /usr/libexec/cni sudo cp bin/* /usr/libexec/cni mkdir -p /etc/cni/net.d curl -qsSL https://raw.githubusercontent.com/containers/libpod/master/cni/87-podman-bridge.conflist | tee /etc/cni/net.d/99-loopback.conf
Step 5 – Install Runc OCI Container Runtime
Download and build Runc OCI runtime from the source:
git clone https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc cd $GOPATH/src/github.com/opencontainers/runc make BUILDTAGS="seccomp" sudo cp runc /usr/bin/runc
Verify Runc installation:
runc --help
Step 6 – Install Podman
Download and build Podman from the source:
git clone https://github.com/containers/libpod/ $GOPATH/src/github.com/containers/libpod cd $GOPATH/src/github.com/containers/libpod make sudo make install PREFIX=/usr
Verify Podman installation:
podman version podman info
Test Podman by pulling and running a container image:
podman search alpine podman pull alpine podman images podman run --net host --rm -ti alpine echo 'Hello Podman'
Using Podman
For more information on how to use Podman, visit: Getting Started with Podman: Manage Images, Containers, and Volumes
References
FAQ
What is Podman?
Podman is a container runtime that allows users to manage OCI containers and pods, providing a daemonless alternative to Docker.
Why use Podman instead of Docker?
Podman can run containers without requiring root privileges or a daemon, offering increased security and flexibility in container management.
Is Podman compatible with Docker?
Podman is designed to be a drop-in replacement for Docker, providing similar commands and functionality, making migration easier.