This section is about basic use and is a suitable quick howto for newcomers.
The very first step with iocage is to fetch a RELEASE. By default iocage will attempt to fetch the host’s current RELEASE from the freebsd.org servers. Once the RELEASE bits are downloaded, the most recent patches are applied too.
Simply run:
iocage fetch
If a specific RELEASE is required run:
iocage fetch release=9.3-RELEASE
In case a specific download mirror is required simply run:
iocage fetch ftphost=ftp.hostname.org
There are three supported basic jail types: full, clone and base jail. In addition to these three there are two more which are discussed later (empty and templates). Depending on requirements the create subcommand can be tweaked to create any of the three types. By default iocage will create a fully independent jail of the current host’s RELEASE and set the TAG property to todays date.
Creating a jail is real simple, just run:
iocage create
This will create a fully independent jail.
To create a lightweight jail (clone) run:
iocage create -c
To create a base jail:
iocage create -b
To create a jail and set its IP address and tag property run:
iocage create -c tag=myjail ip4_addr="em0|10.1.1.10/24"
For more information please read iocage(8).
To list all jails run:
iocage list
To see all downloaded RELEASEs run:
iocage list -r
To see available templates run:
iocage list -t
To start or stop any jail on the system both the UUID or TAG can be used interchangeably. To simplify UUID handling iocage accepts a partial UUID too with any subcommand.
To start a jail tagged www01 simply run:
iocage start www01
To start a jail with a full UUID run:
iocage start 26e8e027-f00c-11e4-8f7f-3c970e80eb61
Or to start the jail only with a partial UUID enter the first few characters only:
iocage start 26e8
To restart a jail run:
iocage restart www01
Note: Short UUIDs are supported with all operations and subcommands within iocage.
Any property can be reconfigured with the set subcommand.
Starting with version 1.6.0 system wide defaults can be set. These defaults will be re-applied for all newly created jails. To create a system wide default override for a property simply specify the default keyword instead of a jail UUID or TAG.
Example, to turn off VNET capability for all newly created jails run:
iocage set vnet=off default
To destroy a jail, simply run:
iocage destroy www02
Warning: this will irreversibly destroy the jail!