How to install containerd on Raspberry Pi

You need to be running at least Raspbian OS with Buster or Raspberry Pi OS (might work with older OS versions too, but I haven’t tested it).

I’ve also updated the system, firmware, apps, etc to the latest version:

1
2
3
sudo apt update
sudo apt full-upgrade
sudo rpi-update

We need Go to install runc and containerd.

Download the Go archive (check downloads for other distributions):

1
wget https://golang.org/dl/go1.15.6.linux-armv6l.tar.gz

Extract the archive to /usr/local:

1
tar -C /usr/local -xzf go1.15.6.linux-armv6l.tar.gz

Add the binary to PATH (in ~/.profile or ~/.bash_profile):

1
echo 'PATH="$PATH:/usr/local/go/bin"' | tee -a $HOME/.profile

Set the GOPATH (get it from go env GOPATH):

1
echo "export GOPATH=$(go env GOPATH)" | tee -a $HOME/.profile

Reload the shell and verify the installation:

1
2
3
source $HOME/.profile
go version
# go version go1.15.6 linux/arm

We need runc to spawn and run containers.

Install libseccomp-dev for seccomp support:

1
sudo apt install libseccomp libseccomp-dev

Install runc:

1
2
3
4
go get -v github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc
make -j`nproc`
sudo env PATH="$PATH" make install

Install btrfs libs and tools:

1
sudo apt install btrfs-progs libbtrfs-dev

Install the tools we need to build protobuf (we assume make, g++, curl and unzip are already installed):

1
sudo apt install autoconf automake libtool

Install protobuf (if g++ dies or ld errors, lower the cpu cores used, e.g -j3, -j2, -j1 and/or enable overclocking and increase swap):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout v3.14.0
git submodule update --init --recursive
./autogen.sh
./configure
make -j2
make -l2 -j2 check
sudo make install
sudo ldconfig
Note
If the IoTest.LargeOutput test fails, it’s probably just due to the lack of memory.

Install containerd:

1
2
3
4
go get -v github.com/containerd/containerd
cd $GOPATH/src/github.com/containerd/containerd
make -j2
sudo env PATH="$PATH" make install

Verify the installation:

1
2
containerd --version
# containerd github.com/containerd/containerd v1.4.0-2397-ge98d7f8ea e98d7f8eaafce9da741ef37c7fedcde571806dcb

Run containerd as a systemd service:

1
2
3
4
5
cd $GOPATH/src/github.com/containerd/containerd
sudo cp containerd.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable containerd.service
sudo systemctl start containerd.service

That’s it, containerd should be up and running.

To test it, follow the getting started guide, or follow the simple guide from rolandjitsu/containerd-oci-import (illustrates how to use local OCI images too).