1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
|
'\" t
.TH "SYSTEMD\&.NSPAWN" "5" "" "systemd 241" "systemd.nspawn"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd.nspawn \- Container settings
.SH "SYNOPSIS"
.PP
/etc/systemd/nspawn/\fImachine\fR\&.nspawn
.PP
/run/systemd/nspawn/\fImachine\fR\&.nspawn
.PP
/var/lib/machines/\fImachine\fR\&.nspawn
.SH "DESCRIPTION"
.PP
An nspawn container settings file (suffix
\&.nspawn) encodes additional runtime information about a local container, and is searched, read and used by
\fBsystemd-nspawn\fR(1)
when starting a container\&. Files of this type are named after the containers they define settings for\&. They are optional, and only required for containers whose execution environment shall differ from the defaults\&. Files of this type mostly contain settings that may also be set on the
\fBsystemd\-nspawn\fR
command line, and make it easier to persistently attach specific settings to specific containers\&. The syntax of these files is inspired by
\&.desktop
files following the
\m[blue]\fBXDG Desktop Entry Specification\fR\m[]\&\s-2\u[1]\d\s+2, which in turn are inspired by Microsoft Windows
\&.ini
files\&.
.PP
Boolean arguments used in these settings files can be written in various formats\&. For positive settings, the strings
\fB1\fR,
\fByes\fR,
\fBtrue\fR
and
\fBon\fR
are equivalent\&. For negative settings, the strings
\fB0\fR,
\fBno\fR,
\fBfalse\fR
and
\fBoff\fR
are equivalent\&.
.PP
Empty lines and lines starting with # or ; are ignored\&. This may be used for commenting\&. Lines ending in a backslash are concatenated with the following line while reading and the backslash is replaced by a space character\&. This may be used to wrap long lines\&.
.SH "\&.NSPAWN FILE DISCOVERY"
.PP
Files are searched by appending the
\&.nspawn
suffix to the machine name of the container, as specified with the
\fB\-\-machine=\fR
switch of
\fBsystemd\-nspawn\fR, or derived from the directory or image file name\&. This file is first searched in
/etc/systemd/nspawn/
and
/run/systemd/nspawn/\&. If found in these directories, its settings are read and all of them take full effect (but are possibly overridden by corresponding command line arguments)\&. If not found, the file will then be searched next to the image file or in the immediate parent of the root directory of the container\&. If the file is found there, only a subset of the settings will take effect however\&. All settings that possibly elevate privileges or grant additional access to resources of the host (such as files or directories) are ignored\&. To which options this applies is documented below\&.
.PP
Persistent settings files created and maintained by the administrator (and thus trusted) should be placed in
/etc/systemd/nspawn/, while automatically downloaded (and thus potentially untrusted) settings files are placed in
/var/lib/machines/
instead (next to the container images), where their security impact is limited\&. In order to add privileged settings to
\&.nspawn
files acquired from the image vendor, it is recommended to copy the settings files into
/etc/systemd/nspawn/
and edit them there, so that the privileged options become available\&. The precise algorithm for how the files are searched and interpreted may be configured with
\fBsystemd\-nspawn\fR\*(Aqs
\fB\-\-settings=\fR
switch, see
\fBsystemd-nspawn\fR(1)
for details\&.
.SH "[EXEC] SECTION OPTIONS"
.PP
Settings files may include an
"[Exec]"
section, which carries various execution parameters:
.PP
\fIBoot=\fR
.RS 4
Takes a boolean argument, which defaults to off\&. If enabled,
\fBsystemd\-nspawn\fR
will automatically search for an
init
executable and invoke it\&. In this case, the specified parameters using
\fIParameters=\fR
are passed as additional arguments to the
init
process\&. This setting corresponds to the
\fB\-\-boot\fR
switch on the
\fBsystemd\-nspawn\fR
command line\&. This option may not be combined with
\fIProcessTwo=yes\fR\&. This option is the default if the
systemd\-nspawn@\&.service
template unit file is used\&.
.RE
.PP
\fIEphemeral=\fR
.RS 4
Takes a boolean argument, which defaults to off, If enabled, the container is run with a temporary snapshot of its file system that is removed immediately when the container terminates\&. This is equivalent to the
\fB\-\-ephemeral\fR
command line switch\&. See
\fBsystemd-nspawn\fR(1)
for details about the specific options supported\&.
.RE
.PP
\fIProcessTwo=\fR
.RS 4
Takes a boolean argument, which defaults to off\&. If enabled, the specified program is run as PID 2\&. A stub init process is run as PID 1\&. This setting corresponds to the
\fB\-\-as\-pid2\fR
switch on the
\fBsystemd\-nspawn\fR
command line\&. This option may not be combined with
\fIBoot=yes\fR\&.
.RE
.PP
\fIParameters=\fR
.RS 4
Takes a space\-separated list of arguments\&. This is either a command line, beginning with the binary name to execute, or \(en if
\fIBoot=\fR
is enabled \(en the list of arguments to pass to the init process\&. This setting corresponds to the command line parameters passed on the
\fBsystemd\-nspawn\fR
command line\&.
.RE
.PP
\fIEnvironment=\fR
.RS 4
Takes an environment variable assignment consisting of key and value, separated by
"="\&. Sets an environment variable for the main process invoked in the container\&. This setting may be used multiple times to set multiple environment variables\&. It corresponds to the
\fB\-\-setenv=\fR
command line switch\&.
.RE
.PP
\fIUser=\fR
.RS 4
Takes a UNIX user name\&. Specifies the user name to invoke the main process of the container as\&. This user must be known in the container\*(Aqs user database\&. This corresponds to the
\fB\-\-user=\fR
command line switch\&.
.RE
.PP
\fIWorkingDirectory=\fR
.RS 4
Selects the working directory for the process invoked in the container\&. Expects an absolute path in the container\*(Aqs file system namespace\&. This corresponds to the
\fB\-\-chdir=\fR
command line switch\&.
.RE
.PP
\fIPivotRoot=\fR
.RS 4
Selects a directory to pivot to
/
inside the container when starting up\&. Takes a single path, or a pair of two paths separated by a colon\&. Both paths must be absolute, and are resolved in the container\*(Aqs file system namespace\&. This corresponds to the
\fB\-\-pivot\-root=\fR
command line switch\&.
.RE
.PP
\fICapability=\fR, \fIDropCapability=\fR
.RS 4
Takes a space\-separated list of Linux process capabilities (see
\fBcapabilities\fR(7)
for details)\&. The
\fICapability=\fR
setting specifies additional capabilities to pass on top of the default set of capabilities\&. The
\fIDropCapability=\fR
setting specifies capabilities to drop from the default set\&. These settings correspond to the
\fB\-\-capability=\fR
and
\fB\-\-drop\-capability=\fR
command line switches\&. Note that
\fICapability=\fR
is a privileged setting, and only takes effect in
\&.nspawn
files in
/etc/systemd/nspawn/
and
/run/system/nspawn/
(see above)\&. On the other hand,
\fIDropCapability=\fR
takes effect in all cases\&.
.RE
.PP
\fINoNewPrivileges=\fR
.RS 4
Takes a boolean argument that controls the
\fBPR_SET_NO_NEW_PRIVS\fR
flag for the container payload\&. This is equivalent to the
\fB\-\-no\-new\-privileges=\fR
command line switch\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fIKillSignal=\fR
.RS 4
Specify the process signal to send to the container\*(Aqs PID 1 when nspawn itself receives SIGTERM, in order to trigger an orderly shutdown of the container\&. Defaults to SIGRTMIN+3 if
\fBBoot=\fR
is used (on systemd\-compatible init systems SIGRTMIN+3 triggers an orderly shutdown)\&. For a list of valid signals, see
\fBsignal\fR(7)\&.
.RE
.PP
\fIPersonality=\fR
.RS 4
Configures the kernel personality for the container\&. This is equivalent to the
\fB\-\-personality=\fR
switch\&.
.RE
.PP
\fIMachineID=\fR
.RS 4
Configures the 128\-bit machine ID (UUID) to pass to the container\&. This is equivalent to the
\fB\-\-uuid=\fR
command line switch\&. This option is privileged (see above)\&.
.RE
.PP
\fIPrivateUsers=\fR
.RS 4
Configures support for usernamespacing\&. This is equivalent to the
\fB\-\-private\-users=\fR
command line switch, and takes the same options\&. This option is privileged (see above)\&. This option is the default if the
systemd\-nspawn@\&.service
template unit file is used\&.
.RE
.PP
\fINotifyReady=\fR
.RS 4
Configures support for notifications from the container\*(Aqs init process\&. This is equivalent to the
\fB\-\-notify\-ready=\fR
command line switch, and takes the same parameters\&. See
\fBsystemd-nspawn\fR(1)
for details about the specific options supported\&.
.RE
.PP
\fISystemCallFilter=\fR
.RS 4
Configures the system call filter applied to containers\&. This is equivalent to the
\fB\-\-system\-call\-filter=\fR
command line switch, and takes the same list parameter\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fILimitCPU=\fR, \fILimitFSIZE=\fR, \fILimitDATA=\fR, \fILimitSTACK=\fR, \fILimitCORE=\fR, \fILimitRSS=\fR, \fILimitNOFILE=\fR, \fILimitAS=\fR, \fILimitNPROC=\fR, \fILimitMEMLOCK=\fR, \fILimitLOCKS=\fR, \fILimitSIGPENDING=\fR, \fILimitMSGQUEUE=\fR, \fILimitNICE=\fR, \fILimitRTPRIO=\fR, \fILimitRTTIME=\fR
.RS 4
Configures various types of resource limits applied to containers\&. This is equivalent to the
\fB\-\-rlimit=\fR
command line switch, and takes the same arguments\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fIOOMScoreAdjust=\fR
.RS 4
Configures the OOM score adjustment value\&. This is equivalent to the
\fB\-\-oom\-score\-adjust=\fR
command line switch, and takes the same argument\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fICPUAffinity=\fR
.RS 4
Configures the CPU affinity\&. This is equivalent to the
\fB\-\-cpu\-affinity=\fR
command line switch, and takes the same argument\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fIHostname=\fR
.RS 4
Configures the kernel hostname set for the container\&. This is equivalent to the
\fB\-\-hostname=\fR
command line switch, and takes the same argument\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fIResolvConf=\fR
.RS 4
Configures how
/etc/resolv\&.conf
in the container shall be handled\&. This is equivalent to the
\fB\-\-resolv\-conf=\fR
command line switch, and takes the same argument\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fITimezone=\fR
.RS 4
Configures how
/etc/localtime
in the container shall be handled\&. This is equivalent to the
\fB\-\-timezone=\fR
command line switch, and takes the same argument\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.PP
\fILinkJournal=\fR
.RS 4
Configures how to link host and container journal setups\&. This is equivalent to the
\fB\-\-link\-journal=\fR
command line switch, and takes the same parameter\&. See
\fBsystemd-nspawn\fR(1)
for details\&.
.RE
.SH "[FILES] SECTION OPTIONS"
.PP
Settings files may include a
"[Files]"
section, which carries various parameters configuring the file system of the container:
.PP
\fIReadOnly=\fR
.RS 4
Takes a boolean argument, which defaults to off\&. If specified, the container will be run with a read\-only file system\&. This setting corresponds to the
\fB\-\-read\-only\fR
command line switch\&.
.RE
.PP
\fIVolatile=\fR
.RS 4
Takes a boolean argument, or the special value
"state"\&. This configures whether to run the container with volatile state and/or configuration\&. This option is equivalent to
\fB\-\-volatile=\fR, see
\fBsystemd-nspawn\fR(1)
for details about the specific options supported\&.
.RE
.PP
\fIBind=\fR, \fIBindReadOnly=\fR
.RS 4
Adds a bind mount from the host into the container\&. Takes a single path, a pair of two paths separated by a colon, or a triplet of two paths plus an option string separated by colons\&. This option may be used multiple times to configure multiple bind mounts\&. This option is equivalent to the command line switches
\fB\-\-bind=\fR
and
\fB\-\-bind\-ro=\fR, see
\fBsystemd-nspawn\fR(1)
for details about the specific options supported\&. This setting is privileged (see above)\&.
.RE
.PP
\fITemporaryFileSystem=\fR
.RS 4
Adds a
"tmpfs"
mount to the container\&. Takes a path or a pair of path and option string, separated by a colon\&. This option may be used multiple times to configure multiple
"tmpfs"
mounts\&. This option is equivalent to the command line switch
\fB\-\-tmpfs=\fR, see
\fBsystemd-nspawn\fR(1)
for details about the specific options supported\&. This setting is privileged (see above)\&.
.RE
.PP
\fIOverlay=\fR, \fIOverlayReadOnly=\fR
.RS 4
Adds an overlay mount point\&. Takes a colon\-separated list of paths\&. This option may be used multiple times to configure multiple overlay mounts\&. This option is equivalent to the command line switches
\fB\-\-overlay=\fR
and
\fB\-\-overlay\-ro=\fR, see
\fBsystemd-nspawn\fR(1)
for details about the specific options supported\&. This setting is privileged (see above)\&.
.RE
.PP
\fIPrivateUsersChown=\fR
.RS 4
Configures whether the ownership of the files and directories in the container tree shall be adjusted to the UID/GID range used, if necessary and user namespacing is enabled\&. This is equivalent to the
\fB\-\-private\-users\-chown\fR
command line switch\&. This option is privileged (see above)\&.
.RE
.SH "[NETWORK] SECTION OPTIONS"
.PP
Settings files may include a
"[Network]"
section, which carries various parameters configuring the network connectivity of the container:
.PP
\fIPrivate=\fR
.RS 4
Takes a boolean argument, which defaults to off\&. If enabled, the container will run in its own network namespace and not share network interfaces and configuration with the host\&. This setting corresponds to the
\fB\-\-private\-network\fR
command line switch\&.
.RE
.PP
\fIVirtualEthernet=\fR
.RS 4
Takes a boolean argument\&. Configures whether to create a virtual Ethernet connection ("veth") between host and the container\&. This setting implies
\fIPrivate=yes\fR\&. This setting corresponds to the
\fB\-\-network\-veth\fR
command line switch\&. This option is privileged (see above)\&. This option is the default if the
systemd\-nspawn@\&.service
template unit file is used\&.
.RE
.PP
\fIVirtualEthernetExtra=\fR
.RS 4
Takes a colon\-separated pair of interface names\&. Configures an additional virtual Ethernet connection ("veth") between host and the container\&. The first specified name is the interface name on the host, the second the interface name in the container\&. The latter may be omitted in which case it is set to the same name as the host side interface\&. This setting implies
\fIPrivate=yes\fR\&. This setting corresponds to the
\fB\-\-network\-veth\-extra=\fR
command line switch, and maybe be used multiple times\&. It is independent of
\fIVirtualEthernet=\fR\&. This option is privileged (see above)\&.
.RE
.PP
\fIInterface=\fR
.RS 4
Takes a space\-separated list of interfaces to add to the container\&. This option corresponds to the
\fB\-\-network\-interface=\fR
command line switch and implies
\fIPrivate=yes\fR\&. This option is privileged (see above)\&.
.RE
.PP
\fIMACVLAN=\fR, \fIIPVLAN=\fR
.RS 4
Takes a space\-separated list of interfaces to add MACLVAN or IPVLAN interfaces to, which are then added to the container\&. These options correspond to the
\fB\-\-network\-macvlan=\fR
and
\fB\-\-network\-ipvlan=\fR
command line switches and imply
\fIPrivate=yes\fR\&. These options are privileged (see above)\&.
.RE
.PP
\fIBridge=\fR
.RS 4
Takes an interface name\&. This setting implies
\fIVirtualEthernet=yes\fR
and
\fIPrivate=yes\fR
and has the effect that the host side of the created virtual Ethernet link is connected to the specified bridge interface\&. This option corresponds to the
\fB\-\-network\-bridge=\fR
command line switch\&. This option is privileged (see above)\&.
.RE
.PP
\fIZone=\fR
.RS 4
Takes a network zone name\&. This setting implies
\fIVirtualEthernet=yes\fR
and
\fIPrivate=yes\fR
and has the effect that the host side of the created virtual Ethernet link is connected to an automatically managed bridge interface named after the passed argument, prefixed with
"vz\-"\&. This option corresponds to the
\fB\-\-network\-zone=\fR
command line switch\&. This option is privileged (see above)\&.
.RE
.PP
\fIPort=\fR
.RS 4
Exposes a TCP or UDP port of the container on the host\&. This option corresponds to the
\fB\-\-port=\fR
command line switch, see
\fBsystemd-nspawn\fR(1)
for the precise syntax of the argument this option takes\&. This option is privileged (see above)\&.
.RE
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd-nspawn\fR(1),
\fBsystemd.directives\fR(7)
.SH "NOTES"
.IP " 1." 4
XDG Desktop Entry Specification
.RS 4
\%http://standards.freedesktop.org/desktop-entry-spec/latest/
.RE
|