To upgrade the jail to a new major or minor version, first upgrade the host system as described in Performing Major and Minor Version Upgrades. Once the host has been upgraded and rebooted, the jail can then be upgraded.
For example to upgrade from 13.1-RELEASE to 13.2-RELEASE, execute the following commands on the host:
It is necessary to execute the install step two times. The first one upgrades the kernel, and the second one upgrades the rest of the components.
Then, if it was a major version upgrade, reinstall all installed packages and restart the jail again. This is required because the ABI version changes when upgrading between major versions of FreeBSD.
First create a ZFS or UFS dataset / directory to store the jail. The default path is /usr/local/jails/containers/<jail_name>.
Now install the jail content into that directory using the following command and following the install wizard:
bsdinstall jail <path_to_jail_dir>
Now create a jail configuration file. This file can be added to the directory /etc/jail.conf.d and should have the jailname as its name like this: <jail_name>.conf
Also create another file at /etc/jail.conf with the following content to include all jail configuration files:
.include "/etc/jail.conf.d/*.conf";
The content of the actual configuration file could look like this: