Running FreeBSD docker images on non-FreeBSD hosts

Allan Jude allanjude at freebsd.org
Tue May 31 22:07:00 UTC 2016


On 2016-05-31 17:02, Jeff Terrell wrote:
> To work around the current inability to mount volumes in FreeBSD docker,
> I'd like to use a FreeBSD docker image on a non-FreeBSD host. Then I can
> both run FreeBSD in a docker container and mount a volume in the container,
> both of which are necessary for my purposes.
>
> (For background, I'm trying to do this to extend jsass, the Java SASS
> compiler [1], to work on FreeBSD. I started a thread documenting this
> attempt on Github [2].)
>
> [1] https://github.com/bit3/jsass
> [2] https://github.com/bit3/jsass/issues/40
>
> Unfortunately, every FreeBSD image I can find requires a FreeBSD host to
> run. This requirement is rarely documented, but it is absolute, at least at
> the moment. For each image matching "freebsd" on Docker Hub, I pulled the
> image, ran `docker run IMAGE_NAME ls`, and the command produced the output
> I expected when I ran it on my FreeBSD machine, but not when I ran it on my
> iMac. (I added comments on Docker Hub to this effect, to hopefully save
> others some time and spare them some confusion.)
>
> 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?
>
> 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.
>
> Solving this problem could, of course, open some avenues for others to
> discover and use FreeBSD relatively painlessly, so I'm thinking it would be
> helpful in general to the FreeBSD community.
>
> Can somebody point me in the right direction here?
>
> Thanks,
>

Yes, FreeBSD docker images will require a FreeBSD host. You can't run 
Mac OS X applications on a Linux box either. It is a different operating 
system. You may be spoiled by the ability of a FreeBSD host to run some 
Linux images, via the linux_compat layer.

The only way to run a FreeBSD docker image on another OS would be via a VM.

I am not that familiar with docker, what do you mean by 'mount of a 
volume in the docker'

-- 
Allan Jude


More information about the freebsd-virtualization mailing list