Docker can be installed on FreeBSD starting from version 11. Docker needs the following pre-requisites to be installed on a FreeBSD 11 machine. FreeBSD 11 is in development stage as of 28/07/2015. FreeBSD development images can be downloaded from the following link. Here I have chosen AMD64 architecture. The image is build released on 16/7/2015.
ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-amd64-20150716-r285616-disc1.iso
Start the installation by booting off the CD. While installing, choose the root partition to be installed on ZFS file system. If you want to use UFS as the root partition, then ZFS partition has to be created separately. Install Docker and dependencies using the following command.
pkg install docker-freebsd ca_root_nss
Enable Docker service.
sysrc -f /etc/rc.conf docker_enable="YES"
Start Docker service.
service docker start
Once Docker service is installed, check the version using the following command.
docker version
The output will be like this.
Client version: 1.7.0-dev Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 582db78 OS/Arch (client): freebsd/amd64 Server version: 1.7.0-dev Server API version: 1.19 Go version (server): go1.4.2 Git commit (server): 582db78 OS/Arch (server): freebsd/amd64
Search the Docker repository for images of any operating system, for example FreeBSD.
docker search freebsd
The output will be like this.
NAME DESCRIPTION STARS OFFICIAL AUTOMATED kazuyoshi/freebsd-minimal 1 roobixx/docker-dg DansGuardian is an award winning Open Sour... 1 [OK] lexaguskov/freebsd FreeBSD operating system 0 mattboll/freebsd testing freebsd images 0 jamesandariese/go-freebsd-amd64 0 [OK] jamesandariese/go-freebsd-386 0 [OK] jamesandariese/go-freebsd-arm 0 [OK]
Choose one of these images. If you choose “lexaguskov/freebsd” for example, use the following command to pull this image from the repository.
docker pull lexaguskov/freebsd
Once the image has been pulled from the repository, use the following command to list the images.
docker images
The output will be like this.
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE lexaguskov/freebsd latest 4e791e7444fe 8 weeks ago 302.9 MB
Run the pulled Docker container using the following command.
docker run -t -i lexaguskov/freebsd /bin/csh
Now from another terminal you can view the list of running containers using the following command.
docker ps
The output will be like this.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7a100c87a482 lexaguskov/freebsd "/bin/csh" About a minute ago Up About a minute hungry_poincare
You can stop the container by typing the following command from inside the container.
exit
You can also pull Linux images and run Linux containers. For example, you can search for Ubuntu images.
docker search ubuntu
The output will be like this
NAME DESCRIPTION STARS OFFICIAL AUTOMATED ubuntu Ubuntu is a Debian-based Linux operating s... 1983 [OK] ubuntu-upstart Upstart is an event-based replacement for ... 28 [OK] torusware/speedus-ubuntu Always updated official Ubuntu docker imag... 25 [OK] dorowu/ubuntu-desktop-lxde-vnc Ubuntu with openssh-server and NoVNC on po... 17 [OK] tleyden5iwx/ubuntu-cuda Ubuntu 14.04 with CUDA drivers pre-installed 16 [OK] ubuntu-debootstrap debootstrap --variant=minbase --components... 11 [OK] neurodebian NeuroDebian provides neuroscience research... 10 [OK] guilhem/vagrant-ubuntu 9 [OK] rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 4 [OK] fike/ubuntu-postgresql PostgreSQL 9.4 beta until 9.0 version runn... 4 [OK] n3ziniuka5/ubuntu-oracle-jdk Ubuntu with Oracle JDK. Check tags for ver... 3 [OK] sameersbn/ubuntu 3 [OK] armbuild/ubuntu-debootstrap ARMHF port of ubuntu-debootstrap 2 [OK] nuagebec/ubuntu Simple always updated Ubuntu docker images... 2 [OK] maxexcloo/ubuntu Docker base image built on Ubuntu with Sup... 2 [OK] nimmis/ubuntu This is a docker images different LTS vers... 2 [OK] cpuguy83/ubuntu 1 [OK] seetheprogress/ubuntu Ubuntu image provided by seetheprogress us... 1 [OK] alsanium/ubuntu Ubuntu Core image for Docker 1 [OK] densuke/ubuntu-jp-remix Ubuntu Linuxの日本語remix風味です 1 [OK] sylvainlasnier/ubuntu Ubuntu 15.04 root docker images with commo... 1 [OK] partlab/ubuntu Simple Ubuntu docker images. 0 [OK] zoni/ubuntu 0 [OK] envygeeks/ubuntu Updated Ubuntu (latest.) 0 [OK] densuke/ubuntu-supervisor densuke/ubuntu-jp-remix:trusty 上で supe... 0 [OK]
Pull the first Linux container “ubuntu” using the following command.
docker pull ubuntu
Once the container image is pulled, it can be run using the following command.
docker run -t -i ubuntu /bin/bash