1runc-spec(8)                System Manager's Manual               runc-spec(8)
2
3
4

NAME

6       runc-spec - create a new specification file
7
8
9

SYNOPSIS

11       runc spec [option ...]
12
13
14

DESCRIPTION

16       The  spec  command creates the new specification file named config.json
17       for the bundle.
18
19
20       The spec generated is just a starter file. Editing of the spec  is  re‐
21       quired  to  achieve  desired  results. For example, the newly generated
22       spec includes an args parameter that is initially set to  call  the  sh
23       command  when  the  container  is  started.  Calling sh may work for an
24       ubuntu container or busybox, but will not work for containers  that  do
25       not include the sh binary.
26
27
28

OPTIONS

30       --bundle|-b path
31              Set path to the root of the bundle directory.
32
33
34       --rootless
35              Generate a configuration for a rootless container. Note this op‐
36              tion is entirely different from the global --rootless option.
37
38
39

EXAMPLES

41       To run a simple "hello-world" container, one needs to set the args  pa‐
42       rameter  in  the  spec  to  call  hello. This can be done using sed(1),
43       jq(1), or a text editor.
44
45
46       The following commands will:
47        - create a bundle for hello-world;
48        - change the command to run in a container to /hello using jq(1);
49        - run the hello command in a  new  hello-world  container  named  con‐
50       tainer1.
51
52
53              mkdir hello
54              cd hello
55              docker pull hello-world
56              docker export $(docker create hello-world) > hello-world.tar
57              mkdir rootfs
58              tar -C rootfs -xf hello-world.tar
59              runc spec
60              jq '.process.args |= ["/hello"]' < config.json > new.json
61              mv -f new.json config.json
62              runc run container1
63
64
65
66       In  the  run  command above, container1 is the name for the instance of
67       the container that you are starting. The name you provide for the  con‐
68       tainer instance must be unique on your host.
69
70
71       An  alternative  for generating a customized spec config is to use oci-
72       runtime-tool; its sub-command oci-runtime-tool generate has lots of op‐
73       tions  that  can be used to do any customizations as you want. See run‐
74       time-tools  ⟨https://github.com/opencontainers/runtime-tools⟩  to   get
75       more information.
76
77
78       When  starting  a container through runc, the latter usually needs root
79       privileges. If not already running as root, you can  use  sudo(8),  for
80       example:
81
82
83              sudo runc start container1
84
85
86
87       Alternatively,  you can start a rootless container, which has the abil‐
88       ity to run without root privileges.  For this to work,  the  specifica‐
89       tion  file  needs to be adjusted accordingly.  You can pass the --root‐
90       less option to this command to generate a proper rootless spec file.
91
92
93

SEE ALSO

95       runc-run(8), runc(8).
96
97
98
99                                                                  runc-spec(8)
Impressum