runc-spec(8)
β¨ runc-spec β¨
okay bestie, gather round π this is the manual page for runc-spec from the System Manager's Manual β it's the little command that hands you a starter spec file so you can go be a container main character.
π NAME π
runc-spec β create a new specification file. that's it, that's the whole job, and it eats every time π
π¦ SYNOPSIS π¦
runc spec [option ...]
πΈ DESCRIPTION πΈ
so the spec command creates a brand-new specification file named config.json for the bundle. one file, freshly born, ready for you to shape π«Ά
but listen β the spec it generates is just a starter file. you will have to edit it to get the results you actually want. it is not a finished masterpiece, it's a first draft.
for example, the newly generated spec includes an args parameter that is initially set to call the sh command when the container is started. and like⦠calling sh may work for an ubuntu container or busybox, but it will not work for containers that do not include the sh binary. so if your container has no sh, that default is giving nothing and you gotta change it. periodt.
π OPTIONS π
--bundle,-bpath β set path to the root of the bundle directory.--rootlessβ generate a configuration for a rootless container. β οΈ note that this option is entirely different from the global--rootlessoption. don't get them confused, they are not the same girl.
π₯ EXAMPLES π₯
to run a simple "hello-world" container, one needs to set the args parameter in the spec to call hello. you can do that using sed(1), jq(1), or a text editor β whatever your vibe is.
the following commands will:
- create a bundle for hello-world;
- change the command to run in a container to
/hellousingjq(1); - run the
hellocommand in a new hello-world container namedcontainer1.
mkdir hello
cd hello
docker pull hello-world
docker export $(docker create hello-world) > hello-world.tar
mkdir rootfs
tar -C rootfs -xf hello-world.tar
runc spec
jq '.process.args |= ["/hello"]' < config.json > new.json
mv -f new.json config.json
runc run container1
in the run command above, container1 is the name for the instance of the container that you are starting. the name you provide for the container instance must be unique on your host. no duplicates allowed, it's giving exclusive β¨
an alternative for generating a customized spec config is to use oci-runtime-tool; its sub-command oci-runtime-tool generate has lots of options that can be used to do any customizations as you want. see runtime-tools https://github.com/opencontainers/runtime-tools to get more information.
when starting a container through runc, the latter usually needs root privileges. if not already running as root, you can use sudo(8), for example:
sudo runc start container1
alternatively, you can start a rootless container, which has the ability to run without root privileges π for this to work, the specification file needs to be adjusted accordingly. you can pass the --rootless option to this command to generate a proper rootless spec file. slay.
π SEE ALSO π
and that's the whole page bestie, no cap π§ this was runc-spec(8) straight out of the System Manager's Manual β go forth and spec responsibly, mwah π
π¦ where this page comes from
- alpine 3.24: runc-doc 1.4.3-r2 Β· Apache-2.0
- arch rolling: runc 1.5.2-1 Β· Apache
- fedora 43: runc 2:1.3.1-1.fc43 Β· Apache-2.0 and BSD-2-Clause and BSD-3-Clause and MIT
- fedora 43: runc 2:1.5.2-3.fc43 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0
- fedora 44: runc 2:1.4.1-1.fc44 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0
- fedora 44: runc 2:1.5.2-3.fc44 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0
- nixpkgs unstable: runc 1.5.2
- ubuntu resolute: runc 1.4.0-0ubuntu1 Β· Apache-2.0
- ubuntu resolute: runc-stable 1.3.4-0ubuntu1 Β· Apache-2.0
- ubuntu stonking: runc 1.5.1-0ubuntu2 Β· Apache-2.0
- ubuntu stonking: runc-stable 1.5.1-0ubuntu2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms