Python iocage With FreeBSD

Print This Post Print This Post

Overview

iocage is one of the most popular jail managers for FreeBSD. Jails are very useful but also difficult to manage. Check out FreeBSD’s documentation for a short primer on jails.
In January 2017 iocage was rewritten in Python and released as a beta. It is in very active development and is shaping up to be even more robust to use than it was before.

Official iocage links:
Github
Documentation

Installation

There are two main ways to install the new iocage. pkg will provide older but more stable releases. git will provide the very latest revision which may be unstable. Use the method most appropriate for your environment.
iocage could also be installed with the ports system, but there’s no benefit over using git. If you want to install iocage’s port, it’s located in sysutils/py-iocage. See here for a guide on using the ports system.

Installing iocage with pkg

This is the easiest method to use. Releases will probably be a version or two behind the other methods, but these will be more stable.
Run the following commands:

pkg update
pkg install py27-iocage

The installer will take care of everything automatically.

Installing iocage with git

This is not as easy as using pkg, but you can always grab the very latest revision that the developers have uploaded to github.
The following package need to be installed first:

python27
py27-pip
git

They can be grabbed from either pkg or ports. See here for instructions on installing FreeBSD software. For example, running:

pkg install python27 py27-pip git

will take care of everything.

Go into a directory that will house iocage (such as /root or /usr/local) and run:

git clone https://github.com/iocage/iocage.git
cd iocage
pip install .

Try launching it by running iocage --version. If no errors show up, you’re good to go!

This post will be updated with some how-to guides for common iocage tasks. Stay tuned!