OCI Containers on FreeBSD
Last updated: 2023-05-14.
Summary
To run FreeBSD or Linux containers:
- Install packages:
pkg install runj containerd nerdctl
- Enable containerd:
sysrc containerd_enable="YES" && service containerd start
- Run a container:
nerdctl run --rm -it knast/freebsd:13-STABLE
For Linux containers, pass --platform linux/amd64
to nerdctl run
.
I’m still trying to find a way to build containers.
Requirements
You need:
runj
: Low-level tool for managing jail-based containers. FreeBSD’s equivalent ofrunc
.containerd
: High-level container runtime. This is also what Docker uses.nerdctl
: Adocker
-compatible frontend for containerd.
Running Containers
For FreeBSD containers:
nerdctl run --net none -it knast/freebsd:13-STABLE
TODO: Figure out why dougrabson/freebsd-minimal:13 isn’t working.
For Linux containers:
nerdctl run --platform linux/amd64 --rm -it debian:11-slim
Networking
TODO.
Relevant link: https://samuel.karp.dev/blog/2022/12/docker-style-networking-for-freebsd-jails-with-runj/.
Building Containers
BuildKit, which both docker build
and nerdctl build
use by default,
is still in the process of being ported to FreeBSD.
TODO: Investigate Buildah and other approaches.