OCI runc is a cool new tool for running containers on Linux machines. It follows the OCI container runtime specification. As of docker-1.11 it is the main mechanism that docker uses for launching containers.
The really cool thing is that you can use runc without even using docker. First you create a rootfs on your disk: a directory that includes all of your software and usually follows the basic layout of
/. There are several tools that can create a rootfs, including dnf or the
atomic command. Once you have a rootfs, you need to create a
config.json file which runc will read.
config.json has all of the specifications for running a container, things like which namespaces to use, which capabilities to use in your container, and what is the pid 1 of your container. It is somewhat similar to the output of
Creating and editing the config.json is not for the faint of heart, so we developed a command line tool called
ocitools generate that can do the hard work of creating the config.json file.
Creating OCI Configurations
There are four steps to create an OCI configuration using the ocitools generate library:
- Import the ocitools generate library into your project;
- Create an OCI specification generator;
- Modify the specification by calling different methods of the specification generator;
- Save the specification.