Appearance
TrueNAS
TrueNAS Core
Jails
Jails are most similar to Linux Containers, and somewhat like Docker containers. Docker containers are meant to be destroyed and recreated constantly, whereas jails are not. Like Docker containers, you can mount directories from the host to the jail. Like Linux Containers, they each have their own IP address, unlike Docker containers which use their own internal networking or have ports mapped to the host IP address.
iocage
iocage is the jail manager of TrueNAS.
Get list of jails
sudo iocage list
Connect to jail console
sudo iocage console {JAIL-NAME}
Issue jail commands without an interactive console
sudo iocage exec {JAIL-NAME} {COMMAND}
Change jail's power state
sudo iocage <start,stop,restart> {JAIL-NAME}
Mount host directory in jail
sudo iocage fstab -a jailname source_location destination_location nullfs (rw/ro) 0 0
Create a new jail
sudo iocage create -n {NEW-JAIL-NAME} -r 11.3-RELEASE ip4_addr="vnet0|192.168.0.9/24" defaultrouter="192.168.0.1" vnet="on" allow_raw_sockets="1" boot="on"
Auto update jails
update-jails.sh
#!/bin/bash
declare -a vars
eval "vars=(`/usr/local/bin/iocage list | awk '{ print $4 }' | sed '2d' | grep .`)"
for ((I = 0; I < ${#vars[@]}; ++I )); do
if /usr/local/bin/iocage exec "${vars[$I]}" "pkg update && pkg upgrade" | grep -q 'Your packages are up to date.'; then
echo "No need to restart jails"
else
/usr/local/bin/iocage restart "${vars[$I]}"
fi
done
Auto update CloudFlare DNS records
You can find update-ddns.sh under TrueNAS Core in the server-resources repository. You can create a cron job using the TrueNAS Core GUI.
Sources I used
FN11.3 iocage jails - Plex, Tautulli, Sonarr, Radarr, Lidarr, Jackett, Transmission, Organizr | TrueNAS Community How I manually setup my jails
[How-To] Giving Plugins Write Permissions to Your Data | TrueNAS Community Learned how to manage my permissions, specifically solution 3
How to set up an nginx reverse proxy with SSL termination in FreeNAS Guide I followed to setup nginx reverse proxy with SSL wildcard certificate
How to install Nextcloud on FreeNAS in an iocage jail with hardened security - Samuel Dowling Guide I followed to setup hardened nextcloud installation
A bash script to update a Cloudflare DNS A record with the external IP of the source machine · GitHub Guide for CloudFlare DDNS