#!/usr/bin/env bash # Using Docker on TrueNAS SCALE (no Kubernetes) # # Don't setup Apps via the TrueNAS Web GUI (don't choose a pool for Apps when asked) # Make a dedicated docker dataset on one of your data pools # Store this script somewhere else on your pool (not in the Docker dataset) # Make a daeomon.json file in the same directory with the following contents: # {"data-root": "/mnt/path/to/desired/docker/dataset/", "exec-opts": ["native.cgroupdriver=cgroupfs"]} # Then schedule this script to start via System Settings -> Advanced -> Init/Shutdown Scripts -> Add: # Choose Type: Script and choose this script, choose to run at Pre Init under When # # Now install e.g. Portainer to manage your containers SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" # Setup custom Docker config (overwrite if contents changed due to system update) cmp --silent "${SCRIPT_DIR}/daemon.json" /etc/docker/daemon.json || echo "Updating Docker config..." && cp "${SCRIPT_DIR}/daemon.json" /etc/docker/daemon.json echo "Starting Docker" systemctl start docker