Skip to main content
  1. Tech Blog/

Running Potluck Images with containerd

2 mins·
Oci Runj Potluck Containerd Freebsd Oss

This post is a continuation of the small PoC that describes how to manually run a Potluck image directly with runj and describes how Potluck images can be run via containerd.

The Potluck container image library wants to provide complex services out of the box, like e.g. a complete postfix secondary mailserver which also is used in this example.

Installing containerd
#

We reuse the VM from the runj PoC, so let’s start it and directly connect to the console:

$ vm start -f runjvm

All the following commands are executed inside the VM:

$ cd /usr/ports/sysutils/containerd && make install clean

It is suggested that you also install a tool like screen or tmux.

Start containerd
#

Start tmux or screen and start the daemon:

$ containerd

Then open a new terminal so you can execute the following commands.

Test Basic Setup
#

Optionally, you can now easily test the containerd environment according to Samuel Karp’s post to check if everything is working:

$ ctr image pull --snapshotter zfs public.ecr.aws/samuelkarp/freebsd:12.1-RELEASE
...
$ ctr run \
    --snapshotter zfs \
    --runtime wtf.sbk.runj.v1 \
    --rm \
    public.ecr.aws/samuelkarp/freebsd:12.1-RELEASE \
    my-container-id \
    sh -c 'echo "Hello from the container!"'

Convert and Start Postfix From Potluck
#

Prepare OCI Image
#

Download the latest Backup MX Postfix Potluck image (which contains a zfs send blob) and create the ZFS filesystem from it:

$ curl https://potluck.honeyguide.net/postfix-backupmx-nomad/postfix-backupmx-nomad-amd64-13_0_1.0.3.xz > pfix.xz
$ xzcat pfix.xz | zfs recv -F zroot/pfix

Create a tarball from the filesystem:

$ cd /zroot/pfix/m && tar cf /root/postfix.tar . && cd
$ xz postfix.tar

Create an OCI image:

$ runj demo oci-image --input postfix.tar.xz

Import the image and check if it is registered:

$ ctr image import --index-name postfix image.tar
...
$ ctr image ls
...

Run Image in containerd
#

Start the image with two parameters that are passed into the image (see image documentation):

$ ctr run \
    --snapshotter zfs \
    --runtime wtf.sbk.runj.v1 \
    --rm \
    postfix \
    my-postfix \
    /usr/local/bin/cook -d mydomain.tld -h myhostname

Now only the network configuration needs to happen to expose the postfix SMTP port to the outside world.

Related

Running Potluck Images with runj
3 mins
Oci Runj Potluck Containerd Freebsd Oss
A quite new project called runj has been created which offers an interface between FreeBSD Jails and containerd. runj is already in the Ports tree or it can be found at https://github.com/samuelkarp/runj.
FreeBSD Virtual Data Centre with Potluck: DevOps & Infrastructure as Code - Part III
7 mins
Oss Minio Virtual Data Centre Infrastructure as Code Devops Microservice Orchestration Nomad Consul Traefik Pot Potluck Object Storage Freebsd
Nginx Example Service (via Traefik) # Overview # As written earlier, you can place the nginx job via the nomad dashboard.
FreeBSD Virtual Data Centre with Potluck: DevOps & Infrastructure as Code - Part II
4 mins
Oss Minio Virtual Data Centre Infrastructure as Code Devops Microservice Orchestration Nomad Consul Traefik Pot Potluck Object Storage Freebsd
Step 3 - Nomad, Consul & Traefik Servers # Note 1: If you do not want to use the prebuilt images as shown below for whatever reason, you can easily recreate the jails from the flavour configuration files yourself by following the instructions on the page of each of the images at Potluck.