TechnologyTrueNAS - Scale

TrueNAS Scale – Use Vanilla Docker

By December 15, 20213 Comments

Introduction

This article simply outlines the steps required to use vanilla docker on TrueNAS Scale, instead of the built-in apps system.

This article is for you IF….

  1. You wish to use a normal, vanilla docker experience.
  2. You do NOT like kubernetes, and wish to use normal docker, or docker swarm.
  3. You are a TECHNICAL INDIVIDUAL, who is capable of troubleshooting.

This article is NOT for you IF….

  1. You wish to be supported by IX-Systems. The below steps, are completely unsupported.
  2. You want to use the built-in apps interface. This will break that.
  3. You want to just point and click on the GUI to install plex. This is a hands-on process, for people familiar with managing docker via the CLI, or portainer.
  4. You do not know what SSH, CLI, Bridges, Bonds is.

First Steps – Startup Scripts.

To use a vanilla docker experience, we first need to create a few scripts, intended to configure your docker experience.

The first step, is to build a docker/daemon.json file. Lets store this in a persistent directory. I personally use… /mnt/Main/Home/root

{
        "data-root": "/mnt/Flash/docker",
        "exec-opts": ["native.cgroupdriver=cgroupfs"],
        "storage-driver": "zfs",
        "iptables": true,
        "bridge": "",
        "dns": ["10.100.4.1"]
}

Make sure to update the DNS IP address to your DNS server. As well, you can also change the storage driver if you prefer. I personally switched to the AUFS driver for simplicity. A list of available drivers is here: Docker Storage Drivers

Lastly, set the data-root to a persistent dataset on your system. Docker will store ALL of its images, volumes, and configuration here.

Next, we need a script to start, and configure docker.

This script does three things.

  1. Stops docker service if it is running.
  2. Remove any docker/daemon.json if it exists.
  3. Copies the daemon.json we created earlier to the proper location.
  4. Starts docker via systemctl.
systemctl stop docker
rm /etc/docker/daemon.json
cp docker_config.json /etc/docker/daemon.json
systemctl start docker

At this point, if you invoke the above script, it should startup a fresh copy of docker.

If you run

docker ps

It should return back an empty table, with nothing running. If not, something isn’t correct. Make sure your modified docker/daemon.json file has a new/fresh dataset that was not in use by the built-in apps before.

Next – Install Portainer

I keep a script handy for installing and upgrading portainer.

This script will stop portainer if it is running. and remove its container if it exists.

It will then install portainer, and create a docker volume named “portainer_data” if it does not exist.

NOTE- If you use portainer enterprise edition, replace portainer-ce, with portainer-ee

If you don’t use enterprise edition, portainer IS/WAS giving out free licensees for home users.

upgradeportainer
docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce:latest
docker run -d -p 9000:9000 \
--name=portainer --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest

After you have your script saved, chmod+x upgradeportainer to make the script executable, and then…. execute it.

Docker will proceed to download portainer, and install/run it.

From this point…. open a web browser and navigate to…. https://YourTrueNASHost:9000/ and you should see portainer.

That’s it!

From this point out, you can now manage docker either directly, or via portainer. If you wish to revert to the built-in apps, just delete your /etc/docker/daemon.json and restart the docker service.

Join the discussion 3 Comments

  • Spinningjenny says:

    Hey XO,

    i tried this script, but ran into the issue of “graphdriver plugins are only supported with experimental mode” when i used dockerd -D because docker was not starting. However, it did start using zfs as storage driver. Do you know a fix or have you run into this issue, because it seems like it only accepts zfs?

    Best regards,

    Spinningjenny

Leave a Reply

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 91 other subscribers

%d bloggers like this: