Difficulty: Beginner
Estimated Time: 10 minutes

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Launching Containers using Runc

Runc is a CLI tool for spawning and running containers according to the OCI specification, available at https://github.com/opencontainers/runc

Runc works based on creating a spec that defines how the process should run and what security configuration to apply.

To start, create a folder that has a rootfs for an application. This can be managed via

mkdir /mycontainer
cd /mycontainer

# create the rootfs directory
mkdir rootfs

# export busybox via Docker into the rootfs directory
docker export $(docker create busybox) | tar -C rootfs -xvf -


runc spec

This creates the security model and configuration for

cat config.json

Change the start/launch parameter from sh to /sleep

sed -i 's;"sh";"top";' config.json

Now run the sleep process as a container.

runc run container1

It's possible to view the running runc processes with runc list