Skip to content

Kleene Documentation

Kleene is a container management tool for FreeBSD, similar to Docker but using FreeBSD jails, ZFS and PF.

Kleene is under active development. See the project status.

Pick your path

  • Install Kleene


    Install Kleened and Klee from packages, ports or source.

    Install Kleene

  • Get started


    Containerize an application, persist its data, connect containers together — a step-by-step introduction to Kleene.

    Start the tutorial

  • Build images


    Write a Dockerfile, understand the build context, and keep images small.

    Building images

  • Run containers


    Start containers in the foreground or detached, constrain their resources, and tune them with jail parameters.

    Running containers

  • Networking


    ipnet, vnet and host networking, published ports, and the firewall rules Kleene manages for you.

    Networking

  • Reference


    Every klee command, the Kleened REST API, and the Dockerfile syntax Kleene implements.

    Read the reference

Kleene in 60 seconds

# pkg install kleene-daemon kleene-cli
# sysrc kleened_enable=yes
# service kleened init
# service kleened start

Download a FreeBSD base image and run a command in a container:

$ klee image create fetch-auto
...
Succesfully extracted binaries, creating image...
Created image from the automatically detected version: FreeBSD-15.1-RELEASE-p3 amd64.

image created
a1041764afd3
$ klee run FreeBSD-15.1-RELEASE-p3:latest echo hello
ffd0f89c3259
created execution instance 665e02ab151a
hello

executable 665e02ab151a and its container exited with exit-code 0

Describe an image in a Dockerfile and build it with klee build:

FROM FreeBSD-15.1-RELEASE-p3:latest
RUN pkg bootstrap -y && pkg install -y git
CMD ["/bin/sh"]
$ klee build -t hello .
Step 1/3 : FROM FreeBSD-15.1-RELEASE-p3:latest
Step 2/3 : RUN pkg bootstrap -y && pkg install -y git
...
--> Snapshot created: @8b08f14cffdc
Step 3/3 : CMD ["/bin/sh"]

image created
71a0ef0fee7d

Coming from Docker?

Kleene defines itself relative to Docker. Most concepts map directly, but Kleene runs full FreeBSD userlands in jails backed by ZFS, has no image registry, and implements a subset of the Dockerfile instructions. See Kleene for Docker users for the full picture.

Docker Kleene
docker ps -a klee lsc -a
docker images klee lsi
docker run klee run
docker build klee build
docker exec klee exec
docker network create klee network create
docker volume create klee volume create
bind mount -v /host:/ctr klee run --mount /host:/ctr
docker compose no equivalent

Common tasks

Task Page
Publish a port Networking: publish ports
Mount a host directory Storage: nullfs mounts
Persist data in a volume Storage: volumes
Start containers at boot Running: start automatically
Set jail parameters Running: jail parameters
Limit CPU and memory Running: resource constraints
Create a base image Building: base images
Protect the Kleened socket Operating: protect the Kleened socket
Customize the firewall Networking: firewall
Troubleshoot networking Networking: troubleshooting

Community, FreeBSD and contributing