1NAME() NAME()
2
3
4
5 runc spec - create a new specification file
6
7
8
10 runc spec [command options] [arguments...]
11
12
13
15 The spec command creates the new specification file named "config.json"
16 for the bundle.
17
18
19 The spec generated is just a starter file. Editing of the spec is
20 required to achieve desired results. For example, the newly generated
21 spec includes an args parameter that is initially set to call the "sh"
22 command when the container is started. Calling "sh" may work for an
23 ubuntu container or busybox, but will not work for containers that do
24 not include the "sh" program.
25
26
27
29 To run docker's hello-world container one needs to set the args parame‐
30 ter in the spec to call hello. This can be done using the sed command
31 or a text editor. The following commands create a bundle for
32 hello-world, change the default args parameter in the spec from "sh" to
33 "/hello", then run the hello command in a new hello-world container
34 named container1:
35
36
37 mkdir hello
38 cd hello
39 docker pull hello-world
40 docker export $(docker create hello-world) > hello-world.tar
41 mkdir rootfs
42 tar -C rootfs -xf hello-world.tar
43 runc spec
44 sed -i 's;"sh";"/hello";' config.json
45 runc start container1
46
47
48
49 In the start command above, "container1" is the name for the instance
50 of the container that you are starting. The name you provide for the
51 container instance must be unique on your host.
52
53
54 An alternative for generating a customized spec config is to use
55 "oci-runtime-tool", the sub-command "oci-runtime-tool generate" has
56 lots of options that can be used to do any customizations as you want,
57 see runtime-tools ⟨https://github.com/opencontainers/runtime-tools⟩ to
58 get more information.
59
60
61 When starting a container through runc, runc needs root privilege. If
62 not already running as root, you can use sudo to give runc root privi‐
63 lege. For example: "sudo runc start container1" will give runc root
64 privilege to start the container on your host.
65
66
67 Alternatively, you can start a rootless container, which has the abil‐
68 ity to run without root privileges. For this to work, the specification
69 file needs to be adjusted accordingly. You can pass the parameter
70 --rootless to this command to generate a proper rootless spec file.
71
72
73
75 --bundle value, -b value path to the root of the bundle directory
76 --rootless generate a configuration for a rootless
77 container
78
79
80
81 NAME()