06 October 2015

!!!!!!!!!!!!!!!!!!!OLD!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!OLD!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!OLD!!!!!!!!!!!!!!!!!!! Docker on FreeBSD is terribad, to the point where it was rightfully killed off. Use iocage instead. !!!!!!!!!!!!!!!!!!!OLD!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!OLD!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!OLD!!!!!!!!!!!!!!!!!!!

If you’re thinking of playing around with this Docker thing, I invite you to try it out on FreeBSD. Please note, this is experimental and probably shouldn’t be attempted under any circumstances.

So why Docker? Why not just good old jails? I can run Ubuntu on my FreeBSD gear with Docker. You can’t do that with jails.

Getting started

Step 0, if you will, is to get onto a development branch of FreeBSD. You need to run HEAD to get the Linux 64-bit compatibility. How to do this is in the handbook.

After you get on a development branch, install the docker-freebsd package.

# pkg install docker-freebsd

Docker currently relies on ZFS, so you’ll want to create a file system for that:

# zfs create -o mountpoint=/usr/docker zroot/docker

Enable the docker service to start at boot:

# sysrc docker_enable="YES"

The docker-freebsd package instructs you to set a PF rule, which I add to my pf.conf. As long as you NAT traffic to Docker, it doesn’t matter what firewall you’re using.

Fetching an image

Fetching an image is pretty straightforward if you’re used to Docker.

# docker pull ubuntu:latest

Run something

# docker run -t -i ubuntu /bin/bash
[email protected]:/# uname -a
Linux  2.6.32 FreeBSD 11.0-CURRENT #0 168f374(master): Mon Oct 26 01:16:47 EDT x86_64 x86_64 x86_64 GNU/Linux

Bam! Ubuntu on FreeBSD.