Docker in FreeNAS

Problem:

I have a NAS, it runs FreeNAS. I also have a server, running Docker. I don't want the server anymore. Time to run it on FreeNAS!

Solution:

FreeNAS now supports docker via the 'VMs' tab (currently using FreeNAS version 11.2-U4.1).

The VM that is instantiated is running RancherOS. Rancher is a lightweight docker-based OS which is great at running containers. Having never used it before, I was rather excited!

Login:

First things first - credentials. These don't really seem to be documented anywhere obvious but a quick google will reveal that the default creds are 'rancher' with password 'docker'.

Updating:

RancherOS uses the 'ros' command for many operations, including upgrades. However the FreeNAS VM solution is a bit useless at dealing with upgrades. After running the 'ros os upgrade' command say no to a reboot.

Then edit the following file: /mnt/<pool>/.bhyve_containers/configs/<vm name>/grub/grub.cfg

You'll need to change the version number in the following string: initrd /boot/initrd-v1.5.2 (Change the 1.5.2 to whatever the NEW version is).

You'll also have to change the kernel version on this line: linux /boot/vmlinuz-4.14.122-rancher rancher.password=docker printk.devkmsg=on rancher.state.dev=LABEL=RANCHER_STATE rancher.state.wait rancher.resize_device=/dev/sda (Where mine is 4.14.122).

The version number is shown on-screen when performing the update, however the kernel version is not so straightforward. Best place to look is the RancherOS changelog, which lists the kernel version used for a particular RancherOS version: https://github.com/rancher/os/releases/

Setting IP addressing:

My instance got an IP via DHCP which was rather nice, but I want to fix it to something a little more permenant.

You can set this using 'ros config set':

ros config set rancher.network.interfaces.eth0.address 10.0.20.15/24
ros config set rancher.network.interfaces.eth0.gateway 10.0.20.1
ros config set rancher.network.interfaces.eth0.dhcp false
ros config set rancher.network.dns.search "['dchidell.com']"
ros config set rancher.network.dns.nameservers "['8.8.8.8','8.8.4.4']"