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 [command options] [arguments...]
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
21       required  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" program.
26
27
28

EXAMPLE

30       To run docker's hello-world container one needs to set the args parame‐
31       ter in the spec to call hello. This can be done using the  sed  command
32       or   a  text  editor.  The  following  commands  create  a  bundle  for
33       hello-world, change the default args parameter in the spec from "sh" to
34       "/hello",  then  run  the  hello command in a new hello-world container
35       named container1:
36
37
38              mkdir hello
39              cd hello
40              docker pull hello-world
41              docker export $(docker create hello-world) > hello-world.tar
42              mkdir rootfs
43              tar -C rootfs -xf hello-world.tar
44              runc spec
45              sed -i 's;"sh";"/hello";' config.json
46              runc start container1
47
48
49
50       In the start command above, "container1" is the name for  the  instance
51       of  the  container  that you are starting. The name you provide for the
52       container instance must be unique on your host.
53
54
55       An alternative for generating  a  customized  spec  config  is  to  use
56       "oci-runtime-tool",  the  sub-command  "oci-runtime-tool  generate" has
57       lots of options that can be used to do any customizations as you  want,
58       see  runtime-tools ⟨https://github.com/opencontainers/runtime-tools⟩ to
59       get more information.
60
61
62       When starting a container through runc, runc needs root  privilege.  If
63       not  already running as root, you can use sudo to give runc root privi‐
64       lege. For example: "sudo runc start container1"  will  give  runc  root
65       privilege to start the container on your host.
66
67
68       Alternatively,  you can start a rootless container, which has the abil‐
69       ity to run without root privileges.  For this to work,  the  specifica‐
70       tion file needs to be adjusted accordingly.  You can pass the parameter
71       --rootless to this command to generate a proper rootless spec file.
72
73
74

OPTIONS

76              --bundle value, -b value     path to the root of the bundle directory
77              --rootless                   generate a configuration for a rootless container
78
79
80
81
82                                                                  runc-spec(8)
Impressum