As of yet, docker isn’t supported for the FreeBSD operating system, so there’s no way you can use docker on FreeBSD, natively at least. Several attempts have been made to build the docker source up for FreeBSD, but none that I could find yielded any substantial results. This is likely because FreeBSD lacks some of Linux’s features, such as namespace and cgroups that aren’t yet a part of FreeBSD kernel.
So that leaves us with one option only: using a virtual machine. So we’ll use virtualbox in this tutorial to fire up a Linux VM in FreeBSD and use docker within it.
Step 1: Install docker client and virtual machine in FreeBSD
To install both docker client and virtual machine along with virtual box all in one command, type the following into the shell and hit enter:
The reason why we’re setting up docker-machine with the virtual box is that it facilitates management for Docker hosts. With a docker-machine, you can create servers and install docker on each of them, and also configure each individually.
Step 2: Load the vboxdrv kernel module
With virtualbox installed on your system, load the vboxdrv kernel module. To do this and add your user account to the vboxusers group, you’ll need to run the following command:
Once the command executes, you’ll be able to use vbox. You can use virtual machines after restarting your system.
Step 3: Creating VirtualBox hosts
Use the command below to create a Virtualbox host:
To see every host current on your system.
With a new virtual box host in place, we should set the VM parameters to communicate with the docker client. Use the command below:
Then copy-paste this command to the .bashrc/.zshrc file, and you’re all set to use docker on FreeBSD.
Why go through all this trouble?
Surely there has to be an easier way to run docker, one that doesn’t need the use of virtual machines?
Well, no. As of yet, this is the only way to get docker up and running on a FreeBSD system, because as mentioned earlier, FreeBSD doesn’t have the support for some of the elements that are crucial to docker’s operation.
Then why not use an alternative to docker? I’ve heard rkt is a much better alternative to docker, and it runs on FreeBSD!
Sure, there are many FreeBSD alternatives to docker that are better, if not just as good. The thing is: most people are familiar with docker, and it’s rather daunting to shift platforms completely for some users. Another reason is the lack of instructional material for rkt, so those new to the containerization software would opt for docker instead of its FreeBSD alternatives.
Conclusion
That’s it for this tutorial. Hopefully, you’re now able to use docker on FreeBSD with the box.
from Linux Hint https://ift.tt/3gqwEYk
0 Comments