]>
Commit | Line | Data |
---|---|---|
f757855e LP |
1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ | |
4 | <!ENTITY % entities SYSTEM "custom-entities.ent" > | |
5 | %entities; | |
6 | ]> | |
7 | ||
8 | <!-- | |
572eb058 ZJS |
9 | SPDX-License-Identifier: LGPL-2.1+ |
10 | ||
f757855e LP |
11 | This file is part of systemd. |
12 | ||
13 | Copyright 2015 Lennart Poettering | |
f757855e LP |
14 | --> |
15 | ||
16 | <refentry id="systemd.nspawn"> | |
17 | ||
18 | <refentryinfo> | |
19 | <title>systemd.nspawn</title> | |
20 | <productname>systemd</productname> | |
21 | ||
22 | <authorgroup> | |
23 | <author> | |
24 | <contrib>Developer</contrib> | |
25 | <firstname>Lennart</firstname> | |
26 | <surname>Poettering</surname> | |
27 | <email>lennart@poettering.net</email> | |
28 | </author> | |
29 | </authorgroup> | |
30 | </refentryinfo> | |
31 | ||
32 | <refmeta> | |
33 | <refentrytitle>systemd.nspawn</refentrytitle> | |
34 | <manvolnum>5</manvolnum> | |
35 | </refmeta> | |
36 | ||
37 | <refnamediv> | |
38 | <refname>systemd.nspawn</refname> | |
39 | <refpurpose>Container settings</refpurpose> | |
40 | </refnamediv> | |
41 | ||
42 | <refsynopsisdiv> | |
43 | <para><filename>/etc/systemd/nspawn/<replaceable>machine</replaceable>.nspawn</filename></para> | |
44 | <para><filename>/run/systemd/nspawn/<replaceable>machine</replaceable>.nspawn</filename></para> | |
45 | <para><filename>/var/lib/machines/<replaceable>machine</replaceable>.nspawn</filename></para> | |
46 | </refsynopsisdiv> | |
47 | ||
48 | <refsect1> | |
49 | <title>Description</title> | |
50 | ||
51 | <para>An nspawn container settings file (suffix | |
52 | <filename>.nspawn</filename>) encodes additional runtime | |
53 | information about a local container, and is searched, read and | |
54 | used by | |
55 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
56 | when starting a container. Files of this type are named after the | |
57 | containers they define settings for. They are optional, and only | |
58 | required for containers whose execution environment shall differ | |
59 | from the defaults. Files of this type mostly contain settings that | |
60 | may also be set on the <command>systemd-nspawn</command> command | |
61 | line, and make it easier to persistently attach specific settings | |
62 | to specific containers. The syntax of these files is inspired by | |
63 | <filename>.desktop</filename> files following the <ulink | |
64 | url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG | |
a8eaaee7 | 65 | Desktop Entry Specification</ulink>, which in turn are inspired by |
f757855e LP |
66 | Microsoft Windows <filename>.ini</filename> files.</para> |
67 | ||
68 | <para>Boolean arguments used in these settings files can be | |
b938cb90 | 69 | written in various formats. For positive settings, the strings |
f757855e LP |
70 | <option>1</option>, <option>yes</option>, <option>true</option> |
71 | and <option>on</option> are equivalent. For negative settings, the | |
72 | strings <option>0</option>, <option>no</option>, | |
73 | <option>false</option> and <option>off</option> are | |
74 | equivalent.</para> | |
75 | ||
76 | <para>Empty lines and lines starting with # or ; are | |
77 | ignored. This may be used for commenting. Lines ending | |
78 | in a backslash are concatenated with the following | |
79 | line while reading and the backslash is replaced by a | |
80 | space character. This may be used to wrap long lines.</para> | |
81 | ||
82 | </refsect1> | |
83 | ||
84 | <refsect1> | |
85 | <title><filename>.nspawn</filename> File Discovery</title> | |
86 | ||
87 | <para>Files are searched by appending the | |
88 | <filename>.nspawn</filename> suffix to the machine name of the | |
89 | container, as specified with the <option>--machine=</option> | |
90 | switch of <command>systemd-nspawn</command>, or derived from the | |
91 | directory or image file name. This file is first searched in | |
92 | <filename>/etc/systemd/nspawn/</filename> and | |
93 | <filename>/run/systemd/nspawn/</filename>. If found in these | |
b938cb90 | 94 | directories, its settings are read and all of them take full effect |
4f76ef04 | 95 | (but are possibly overridden by corresponding command line |
b938cb90 | 96 | arguments). If not found, the file will then be searched next to |
f757855e | 97 | the image file or in the immediate parent of the root directory of |
b938cb90 | 98 | the container. If the file is found there, only a subset of the |
f757855e LP |
99 | settings will take effect however. All settings that possibly |
100 | elevate privileges or grant additional access to resources of the | |
101 | host (such as files or directories) are ignored. To which options | |
102 | this applies is documented below.</para> | |
103 | ||
a8eaaee7 | 104 | <para>Persistent settings files created and maintained by the |
f757855e LP |
105 | administrator (and thus trusted) should be placed in |
106 | <filename>/etc/systemd/nspawn/</filename>, while automatically | |
107 | downloaded (and thus potentially untrusted) settings files are | |
108 | placed in <filename>/var/lib/machines/</filename> instead (next to | |
109 | the container images), where their security impact is limited. In | |
110 | order to add privileged settings to <filename>.nspawn</filename> | |
b938cb90 | 111 | files acquired from the image vendor, it is recommended to copy the |
f757855e LP |
112 | settings files into <filename>/etc/systemd/nspawn/</filename> and |
113 | edit them there, so that the privileged options become | |
a8eaaee7 | 114 | available. The precise algorithm for how the files are searched and |
f757855e LP |
115 | interpreted may be configured with |
116 | <command>systemd-nspawn</command>'s <option>--settings=</option> | |
117 | switch, see | |
118 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
119 | for details.</para> | |
120 | </refsect1> | |
121 | ||
122 | <refsect1> | |
123 | <title>[Exec] Section Options</title> | |
124 | ||
125 | <para>Settings files may include an <literal>[Exec]</literal> | |
126 | section, which carries various execution parameters:</para> | |
127 | ||
128 | <variablelist> | |
129 | ||
130 | <varlistentry> | |
131 | <term><varname>Boot=</varname></term> | |
132 | ||
7732f92b LP |
133 | <listitem><para>Takes a boolean argument, which defaults to off. If enabled, <command>systemd-nspawn</command> |
134 | will automatically search for an <filename>init</filename> executable and invoke it. In this case, the | |
135 | specified parameters using <varname>Parameters=</varname> are passed as additional arguments to the | |
136 | <filename>init</filename> process. This setting corresponds to the <option>--boot</option> switch on the | |
137 | <command>systemd-nspawn</command> command line. This option may not be combined with | |
b09c0bba LP |
138 | <varname>ProcessTwo=yes</varname>. This option is the default if the |
139 | <filename>systemd-nspawn@.service</filename> template unit file is used.</para></listitem> | |
7732f92b LP |
140 | </varlistentry> |
141 | ||
142 | <varlistentry> | |
143 | <term><varname>ProcessTwo=</varname></term> | |
144 | ||
145 | <listitem><para>Takes a boolean argument, which defaults to off. If enabled, the specified program is run as | |
146 | PID 2. A stub init process is run as PID 1. This setting corresponds to the <option>--as-pid2</option> switch | |
147 | on the <command>systemd-nspawn</command> command line. This option may not be combined with | |
148 | <varname>Boot=yes</varname>.</para></listitem> | |
f757855e LP |
149 | </varlistentry> |
150 | ||
151 | <varlistentry> | |
152 | <term><varname>Parameters=</varname></term> | |
153 | ||
b938cb90 | 154 | <listitem><para>Takes a space-separated list of |
f757855e LP |
155 | arguments. This is either a command line, beginning with the |
156 | binary name to execute, or – if <varname>Boot=</varname> is | |
157 | enabled – the list of arguments to pass to the init | |
158 | process. This setting corresponds to the command line | |
159 | parameters passed on the <command>systemd-nspawn</command> | |
160 | command line.</para></listitem> | |
161 | </varlistentry> | |
162 | ||
163 | <varlistentry> | |
164 | <term><varname>Environment=</varname></term> | |
165 | ||
166 | <listitem><para>Takes an environment variable assignment | |
167 | consisting of key and value, separated by | |
168 | <literal>=</literal>. Sets an environment variable for the | |
169 | main process invoked in the container. This setting may be | |
170 | used multiple times to set multiple environment variables. It | |
171 | corresponds to the <option>--setenv=</option> command line | |
172 | switch.</para></listitem> | |
173 | </varlistentry> | |
174 | ||
175 | <varlistentry> | |
176 | <term><varname>User=</varname></term> | |
177 | ||
178 | <listitem><para>Takes a UNIX user name. Specifies the user | |
179 | name to invoke the main process of the container as. This user | |
180 | must be known in the container's user database. This | |
181 | corresponds to the <option>--user=</option> command line | |
5f932eb9 LP |
182 | switch.</para></listitem> |
183 | </varlistentry> | |
184 | ||
185 | <varlistentry> | |
186 | <term><varname>WorkingDirectory=</varname></term> | |
187 | ||
188 | <listitem><para>Selects the working directory for the process invoked in the container. Expects an absolute | |
189 | path in the container's file system namespace. This corresponds to the <option>--chdir=</option> command line | |
f757855e LP |
190 | switch.</para></listitem> |
191 | </varlistentry> | |
192 | ||
b53ede69 PW |
193 | <varlistentry> |
194 | <term><varname>PivotRoot=</varname></term> | |
195 | ||
196 | <listitem><para>Selects a directory to pivot to <filename>/</filename> inside the container when starting up. | |
197 | Takes a single path, or a pair of two paths separated by a colon. Both paths must be absolute, and are resolved | |
198 | in the container's file system namespace. This corresponds to the <option>--pivot-root=</option> command line | |
199 | switch.</para></listitem> | |
200 | </varlistentry> | |
201 | ||
f757855e LP |
202 | <varlistentry> |
203 | <term><varname>Capability=</varname></term> | |
204 | <term><varname>DropCapability=</varname></term> | |
205 | ||
b938cb90 | 206 | <listitem><para>Takes a space-separated list of Linux process |
f757855e | 207 | capabilities (see |
524f3e5c | 208 | <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
f757855e LP |
209 | for details). The <varname>Capability=</varname> setting |
210 | specifies additional capabilities to pass on top of the | |
4f76ef04 | 211 | default set of capabilities. The |
f757855e LP |
212 | <varname>DropCapability=</varname> setting specifies |
213 | capabilities to drop from the default set. These settings | |
214 | correspond to the <option>--capability=</option> and | |
215 | <option>--drop-capability=</option> command line | |
216 | switches. Note that <varname>Capability=</varname> is a | |
217 | privileged setting, and only takes effect in | |
218 | <filename>.nspawn</filename> files in | |
219 | <filename>/etc/systemd/nspawn/</filename> and | |
220 | <filename>/run/system/nspawn/</filename> (see above). On the | |
b938cb90 | 221 | other hand, <varname>DropCapability=</varname> takes effect in |
f757855e LP |
222 | all cases.</para></listitem> |
223 | </varlistentry> | |
224 | ||
66edd963 LP |
225 | <varlistentry> |
226 | <term><varname>NoNewPrivileges=</varname></term> | |
227 | ||
228 | <listitem><para>Takes a boolean argument that controls the <constant>PR_SET_NO_NEW_PRIVS</constant> flag for | |
229 | the container payload. This is equivalent to the | |
230 | <option>--no-new-privileges=</option> command line switch. See | |
231 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
232 | details.</para> | |
233 | </listitem> | |
234 | </varlistentry> | |
235 | ||
b3969f73 | 236 | <varlistentry> |
c9648aa6 | 237 | <term><varname>KillSignal=</varname></term> |
b3969f73 PA |
238 | |
239 | <listitem><para>Specify the process signal to send to the | |
240 | container's PID 1 when nspawn itself receives SIGTERM, in | |
241 | order to trigger an orderly shutdown of the container. | |
242 | Defaults to SIGRTMIN+3 if <option>Boot=</option> is used | |
243 | (on systemd-compatible init systems SIGRTMIN+3 triggers an | |
244 | orderly shutdown). For a list of valid signals, see | |
245 | <citerefentry project='man-pages'><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para></listitem> | |
246 | </varlistentry> | |
247 | ||
f757855e LP |
248 | <varlistentry> |
249 | <term><varname>Personality=</varname></term> | |
250 | ||
251 | <listitem><para>Configures the kernel personality for the | |
252 | container. This is equivalent to the | |
253 | <option>--personality=</option> switch.</para></listitem> | |
254 | </varlistentry> | |
255 | ||
256 | <varlistentry> | |
257 | <term><varname>MachineID=</varname></term> | |
258 | ||
b938cb90 | 259 | <listitem><para>Configures the 128-bit machine ID (UUID) to pass to |
f757855e LP |
260 | the container. This is equivalent to the |
261 | <option>--uuid=</option> command line switch. This option is | |
262 | privileged (see above). </para></listitem> | |
263 | </varlistentry> | |
d2e5535f LP |
264 | |
265 | <varlistentry> | |
266 | <term><varname>PrivateUsers=</varname></term> | |
267 | ||
268 | <listitem><para>Configures support for usernamespacing. This is equivalent to the | |
269 | <option>--private-users=</option> command line switch, and takes the same options. This option is privileged | |
b09c0bba LP |
270 | (see above). This option is the default if the <filename>systemd-nspawn@.service</filename> template unit file |
271 | is used.</para></listitem> | |
d2e5535f | 272 | </varlistentry> |
9c1e04d0 AP |
273 | |
274 | <varlistentry> | |
275 | <term><varname>NotifyReady=</varname></term> | |
276 | ||
960e4569 | 277 | <listitem><para>Configures support for notifications from the container's init process. This is equivalent to |
dcfaecc7 | 278 | the <option>--notify-ready=</option> command line switch, and takes the same parameters. See |
960e4569 LP |
279 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for details |
280 | about the specific options supported.</para></listitem> | |
9c1e04d0 | 281 | </varlistentry> |
960e4569 LP |
282 | |
283 | <varlistentry> | |
284 | <term><varname>SystemCallFilter=</varname></term> | |
285 | ||
286 | <listitem><para>Configures the system call filter applied to containers. This is equivalent to the | |
287 | <option>--system-call-filter=</option> command line switch, and takes the same list parameter. See | |
288 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
289 | details.</para></listitem> | |
290 | </varlistentry> | |
bf428efb LP |
291 | |
292 | <varlistentry> | |
293 | <term><varname>LimitCPU=</varname></term> | |
294 | <term><varname>LimitFSIZE=</varname></term> | |
295 | <term><varname>LimitDATA=</varname></term> | |
296 | <term><varname>LimitSTACK=</varname></term> | |
297 | <term><varname>LimitCORE=</varname></term> | |
298 | <term><varname>LimitRSS=</varname></term> | |
299 | <term><varname>LimitNOFILE=</varname></term> | |
300 | <term><varname>LimitAS=</varname></term> | |
301 | <term><varname>LimitNPROC=</varname></term> | |
302 | <term><varname>LimitMEMLOCK=</varname></term> | |
303 | <term><varname>LimitLOCKS=</varname></term> | |
304 | <term><varname>LimitSIGPENDING=</varname></term> | |
305 | <term><varname>LimitMSGQUEUE=</varname></term> | |
306 | <term><varname>LimitNICE=</varname></term> | |
307 | <term><varname>LimitRTPRIO=</varname></term> | |
308 | <term><varname>LimitRTTIME=</varname></term> | |
309 | ||
310 | <listitem><para>Configures various types of resource limits applied to containers. This is equivalent to the | |
311 | <option>--rlimit=</option> command line switch, and takes the same arguments. See | |
312 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
313 | details.</para></listitem> | |
314 | </varlistentry> | |
3a9530e5 | 315 | |
81f345df LP |
316 | <varlistentry> |
317 | <term><varname>OOMScoreAdjust=</varname></term> | |
318 | ||
319 | <listitem><para>Configures the OOM score adjustment value. This is equivalent to the | |
320 | <option>--oom-score-adjust=</option> command line switch, and takes the same argument. See | |
321 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
322 | details.</para></listitem> | |
323 | </varlistentry> | |
324 | ||
d107bb7d LP |
325 | <varlistentry> |
326 | <term><varname>CPUAffinity=</varname></term> | |
327 | ||
328 | <listitem><para>Configures the CPU affinity. This is equivalent to the <option>--cpu-affinity=</option> command | |
329 | line switch, and takes the same argument. See | |
330 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
331 | details.</para></listitem> | |
332 | </varlistentry> | |
333 | ||
3a9530e5 LP |
334 | <varlistentry> |
335 | <term><varname>Hostname=</varname></term> | |
336 | ||
337 | <listitem><para>Configures the kernel hostname set for the container. This is equivalent to the | |
338 | <option>--hostname=</option> command line switch, and takes the same argument. See | |
339 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
340 | details.</para></listitem> | |
341 | </varlistentry> | |
09d423e9 LP |
342 | |
343 | <varlistentry> | |
344 | <term><varname>ResolvConf=</varname></term> | |
345 | ||
346 | <listitem><para>Configures how <filename>/etc/resolv.conf</filename> in the container shall be handled. This is | |
347 | equivalent to the <option>--resolv-conf=</option> command line switch, and takes the same argument. See | |
348 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
349 | details.</para></listitem> | |
350 | </varlistentry> | |
4e1d6aa9 | 351 | |
1688841f LP |
352 | <varlistentry> |
353 | <term><varname>Timezone=</varname></term> | |
354 | ||
355 | <listitem><para>Configures how <filename>/etc/localtime</filename> in the container shall be handled. This is | |
356 | equivalent to the <option>--localtime=</option> command line switch, and takes the same argument. See | |
357 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
358 | details.</para></listitem> | |
359 | </varlistentry> | |
360 | ||
4e1d6aa9 LP |
361 | <varlistentry> |
362 | <term><varname>LinkJournal=</varname></term> | |
363 | ||
364 | <listitem><para>Configures how to link host and container journal setups. This is equivalent to the | |
365 | <option>--link-journal=</option> command line switch, and takes the same parameter. See | |
366 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for | |
367 | details.</para></listitem> | |
368 | </varlistentry> | |
960e4569 | 369 | |
f757855e LP |
370 | </variablelist> |
371 | </refsect1> | |
372 | ||
373 | <refsect1> | |
374 | <title>[Files] Section Options</title> | |
375 | ||
376 | <para>Settings files may include a <literal>[Files]</literal> | |
377 | section, which carries various parameters configuring the file | |
378 | system of the container:</para> | |
379 | ||
380 | <variablelist> | |
381 | ||
382 | <varlistentry> | |
383 | <term><varname>ReadOnly=</varname></term> | |
384 | ||
a8eaaee7 | 385 | <listitem><para>Takes a boolean argument, which defaults to off. If |
b938cb90 | 386 | specified, the container will be run with a read-only file |
f757855e LP |
387 | system. This setting corresponds to the |
388 | <option>--read-only</option> command line | |
389 | switch.</para></listitem> | |
390 | </varlistentry> | |
391 | ||
392 | <varlistentry> | |
393 | <term><varname>Volatile=</varname></term> | |
394 | ||
395 | <listitem><para>Takes a boolean argument, or the special value | |
396 | <literal>state</literal>. This configures whether to run the | |
397 | container with volatile state and/or configuration. This | |
398 | option is equivalent to <option>--volatile=</option>, see | |
399 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
400 | for details about the specific options | |
401 | supported.</para></listitem> | |
402 | </varlistentry> | |
403 | ||
404 | <varlistentry> | |
405 | <term><varname>Bind=</varname></term> | |
406 | <term><varname>BindReadOnly=</varname></term> | |
407 | ||
408 | <listitem><para>Adds a bind mount from the host into the | |
409 | container. Takes a single path, a pair of two paths separated | |
410 | by a colon, or a triplet of two paths plus an option string | |
411 | separated by colons. This option may be used multiple times to | |
412 | configure multiple bind mounts. This option is equivalent to | |
413 | the command line switches <option>--bind=</option> and | |
414 | <option>--bind-ro=</option>, see | |
415 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
416 | for details about the specific options supported. This setting | |
417 | is privileged (see above).</para></listitem> | |
418 | </varlistentry> | |
419 | ||
420 | <varlistentry> | |
421 | <term><varname>TemporaryFileSystem=</varname></term> | |
422 | ||
423 | <listitem><para>Adds a <literal>tmpfs</literal> mount to the | |
424 | container. Takes a path or a pair of path and option string, | |
4f76ef04 | 425 | separated by a colon. This option may be used multiple times to |
f757855e LP |
426 | configure multiple <literal>tmpfs</literal> mounts. This |
427 | option is equivalent to the command line switch | |
428 | <option>--tmpfs=</option>, see | |
429 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
430 | for details about the specific options supported. This setting | |
431 | is privileged (see above).</para></listitem> | |
432 | </varlistentry> | |
d2e5535f | 433 | |
7b4318b6 LP |
434 | <varlistentry> |
435 | <term><varname>Overlay=</varname></term> | |
436 | <term><varname>OverlayReadOnly=</varname></term> | |
437 | ||
438 | <listitem><para>Adds an overlay mount point. Takes a colon-separated list of paths. This option may be used | |
439 | multiple times to configure multiple overlay mounts. This option is equivalent to the command line switches | |
440 | <option>--overlay=</option> and <option>--overlay-ro=</option>, see | |
441 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for details | |
442 | about the specific options supported. This setting is privileged (see above).</para></listitem> | |
443 | </varlistentry> | |
444 | ||
d2e5535f LP |
445 | <varlistentry> |
446 | <term><varname>PrivateUsersChown=</varname></term> | |
447 | ||
448 | <listitem><para>Configures whether the ownership of the files and directories in the container tree shall be | |
449 | adjusted to the UID/GID range used, if necessary and user namespacing is enabled. This is equivalent to the | |
450 | <option>--private-users-chown</option> command line switch. This option is privileged (see | |
451 | above). </para></listitem> | |
452 | </varlistentry> | |
453 | ||
f757855e LP |
454 | </variablelist> |
455 | </refsect1> | |
456 | ||
457 | <refsect1> | |
458 | <title>[Network] Section Options</title> | |
459 | ||
460 | <para>Settings files may include a <literal>[Network]</literal> | |
461 | section, which carries various parameters configuring the network | |
462 | connectivity of the container:</para> | |
463 | ||
464 | <variablelist> | |
465 | ||
466 | <varlistentry> | |
467 | <term><varname>Private=</varname></term> | |
468 | ||
a8eaaee7 | 469 | <listitem><para>Takes a boolean argument, which defaults to off. If |
b938cb90 | 470 | enabled, the container will run in its own network namespace |
f757855e LP |
471 | and not share network interfaces and configuration with the |
472 | host. This setting corresponds to the | |
473 | <option>--private-network</option> command line | |
474 | switch.</para></listitem> | |
475 | </varlistentry> | |
476 | ||
477 | <varlistentry> | |
478 | <term><varname>VirtualEthernet=</varname></term> | |
479 | ||
b09c0bba LP |
480 | <listitem><para>Takes a boolean argument. Configures whether to create a virtual Ethernet connection |
481 | (<literal>veth</literal>) between host and the container. This setting implies | |
482 | <varname>Private=yes</varname>. This setting corresponds to the <option>--network-veth</option> command line | |
483 | switch. This option is privileged (see above). This option is the default if the | |
484 | <filename>systemd-nspawn@.service</filename> template unit file is used.</para></listitem> | |
f757855e LP |
485 | </varlistentry> |
486 | ||
f6d6bad1 LP |
487 | <varlistentry> |
488 | <term><varname>VirtualEthernetExtra=</varname></term> | |
489 | ||
490 | <listitem><para>Takes a colon-separated pair of interface | |
491 | names. Configures an additional virtual Ethernet connection | |
492 | (<literal>veth</literal>) between host and the container. The | |
493 | first specified name is the interface name on the host, the | |
494 | second the interface name in the container. The latter may be | |
495 | omitted in which case it is set to the same name as the host | |
496 | side interface. This setting implies | |
497 | <varname>Private=yes</varname>. This setting corresponds to | |
498 | the <option>--network-veth-extra=</option> command line | |
499 | switch, and maybe be used multiple times. It is independent of | |
500 | <varname>VirtualEthernet=</varname>. This option is privileged | |
501 | (see above).</para></listitem> | |
502 | </varlistentry> | |
503 | ||
f757855e LP |
504 | <varlistentry> |
505 | <term><varname>Interface=</varname></term> | |
506 | ||
b938cb90 | 507 | <listitem><para>Takes a space-separated list of interfaces to |
f757855e LP |
508 | add to the container. This option corresponds to the |
509 | <option>--network-interface=</option> command line switch and | |
510 | implies <varname>Private=yes</varname>. This option is | |
511 | privileged (see above).</para></listitem> | |
512 | </varlistentry> | |
513 | ||
514 | <varlistentry> | |
515 | <term><varname>MACVLAN=</varname></term> | |
516 | <term><varname>IPVLAN=</varname></term> | |
517 | ||
b938cb90 | 518 | <listitem><para>Takes a space-separated list of interfaces to |
f757855e LP |
519 | add MACLVAN or IPVLAN interfaces to, which are then added to |
520 | the container. These options correspond to the | |
521 | <option>--network-macvlan=</option> and | |
522 | <option>--network-ipvlan=</option> command line switches and | |
523 | imply <varname>Private=yes</varname>. These options are | |
524 | privileged (see above).</para></listitem> | |
525 | </varlistentry> | |
526 | ||
527 | <varlistentry> | |
528 | <term><varname>Bridge=</varname></term> | |
529 | ||
530 | <listitem><para>Takes an interface name. This setting implies | |
531 | <varname>VirtualEthernet=yes</varname> and | |
532 | <varname>Private=yes</varname> and has the effect that the | |
533 | host side of the created virtual Ethernet link is connected to | |
534 | the specified bridge interface. This option corresponds to the | |
535 | <option>--network-bridge=</option> command line switch. This | |
536 | option is privileged (see above).</para></listitem> | |
537 | </varlistentry> | |
538 | ||
938d2579 LP |
539 | <varlistentry> |
540 | <term><varname>Zone=</varname></term> | |
541 | ||
542 | <listitem><para>Takes a network zone name. This setting implies <varname>VirtualEthernet=yes</varname> and | |
543 | <varname>Private=yes</varname> and has the effect that the host side of the created virtual Ethernet link is | |
544 | connected to an automatically managed bridge interface named after the passed argument, prefixed with | |
545 | <literal>vz-</literal>. This option corresponds to the <option>--network-zone=</option> command line | |
546 | switch. This option is privileged (see above).</para></listitem> | |
547 | </varlistentry> | |
548 | ||
f757855e LP |
549 | <varlistentry> |
550 | <term><varname>Port=</varname></term> | |
551 | ||
552 | <listitem><para>Exposes a TCP or UDP port of the container on | |
553 | the host. This option corresponds to the | |
554 | <option>--port=</option> command line switch, see | |
555 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
556 | for the precise syntax of the argument this option takes. This | |
557 | option is privileged (see above).</para></listitem> | |
558 | </varlistentry> | |
559 | </variablelist> | |
560 | </refsect1> | |
561 | ||
562 | <refsect1> | |
563 | <title>See Also</title> | |
564 | <para> | |
565 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
566 | <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
567 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
568 | </para> | |
569 | </refsect1> | |
570 | ||
571 | </refentry> |