Running FreeBSD docker images on non-FreeBSD hosts

Kurt Lidl lidl at
Wed Jun 1 15:54:44 UTC 2016

> I'm acquainted with docker, but I don't know enough to understand
> why an image would run in a container on one OS but not in a
> container on another OS. I thought the whole point of docker was
> that, assuming the image worked at all, it worked regardless of which
> host you used. So that's an incidental question I have: what's going
> on here? Is it something particular to FreeBSD's implementation of
> docker?

Docker provides a "container" for running a particular application.
It's similar to a FreeBSD jail, in that the running process(es) in the
container cannot interact with the rest of the system, except at the
system call level, and where the host running docker has mapped any
files into the docker filesystem namespace.

What isn't really explained in so many words -- the container uses the
system calls from the hosting computer to evaluate anything that it
needs the "kernel" to do. So your "FreeBSD docker" image, when run on
a Linux machine, is attempting to make FreeBSD system calls into the
Linux kernel.

> But my main question is, what can I do to run a FreeBSD image on a
> non-FreeBSD host? I'm willing to [figure out how to] build my own
> image if necessary. I just don't want to go to the trouble if it's
> a non-starter for some reason I don't understand.

You'd have to use some other solution to provide a "FreeBSD system call 
interface" to your FreeBSD docker image.

The recent import of Linux 64bit emulation in FreeBSD allows for running
stock "docker" images on FreeBSD, because there's now a shim that
translates Linux system calls to FreeBSD ones.

On the Mac, they have shims that provide filesystem access to the Mac's 
filesystems, and a virtualized machine using the xhyve stuff, providing
the Linux system call interface.

Make no mistake about, docker is Linux inside.

If you want to run FreeBSD inside a virtual machine, try the xhyve stuff
on the Mac, or under KVM on Linux.


More information about the freebsd-virtualization mailing list