github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/podman-systemd.unit.5.md (about) 1 % podman-systemd.unit 5 2 3 ## NAME 4 5 podman\-systemd.unit - systemd units using Podman Quadlet 6 7 ## SYNOPSIS 8 9 *name*.container, *name*.volume, *name*.network, *name*.kube *name*.image, *name*.pod 10 11 ### Podman rootful unit search path 12 13 Quadlet files for the root user can be placed in the following two directories: 14 15 * /etc/containers/systemd/ 16 * /usr/share/containers/systemd/ 17 18 ### Podman rootless unit search path 19 20 Quadlet files for non-root users can be placed in the following directories 21 22 * $XDG_CONFIG_HOME/containers/systemd/ or ~/.config/containers/systemd/ 23 * /etc/containers/systemd/users/$(UID) 24 * /etc/containers/systemd/users/ 25 26 ### Using symbolic links 27 28 Quadlet supports using symbolic links for the base of the search paths. 29 Symbolic links below the search paths are not supported. 30 31 ## DESCRIPTION 32 33 Podman supports starting containers (and creating volumes) via systemd by using a 34 [systemd generator](https://www.freedesktop.org/software/systemd/man/systemd.generator.html). 35 These files are read during boot (and when `systemctl daemon-reload` is run) and generate 36 corresponding regular systemd service unit files. Both system and user systemd units are supported. 37 All options and tables available in standard systemd unit files are supported. For example, options defined in 38 the [Service] table and [Install] tables pass directly to systemd and are handled by it. 39 See systemd.unit(5) man page for more information. 40 41 The Podman generator reads the search paths above and reads files with the extensions `.container` 42 `.volume`, `.network`, `.pod` and `.kube`, and for each file generates a similarly named `.service` file. Be aware that 43 existing vendor services (i.e., in `/usr/`) are replaced if they have the same name. The generated unit files can 44 be started and managed with `systemctl` like any other systemd service. `systemctl {--user} list-unit-files` 45 lists existing unit files on the system. 46 47 The Podman files use the same format as [regular systemd unit files](https://www.freedesktop.org/software/systemd/man/systemd.syntax.html). 48 Each file type has a custom section (for example, `[Container]`) that is handled by Podman, and all 49 other sections are passed on untouched, allowing the use of any normal systemd configuration options 50 like dependencies or cgroup limits. 51 52 The source files also support drop-ins in the same [way systemd does](https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html). 53 For a given source file (say `foo.container`), the corresponding `.d`directory (in this 54 case `foo.container.d`) will be scanned for files with a `.conf` extension that are merged into 55 the base file in alphabetical order. The format of these drop-in files is the same as the base file. 56 This is useful to alter or add configuration settings for a unit, without having to modify unit 57 files. 58 59 For rootless containers, when administrators place Quadlet files in the 60 /etc/containers/systemd/users directory, all users' sessions execute the 61 Quadlet when the login session begins. If the administrator places a Quadlet 62 file in the /etc/containers/systemd/users/${UID}/ directory, then only the 63 user with the matching UID execute the Quadlet when the login 64 session gets started. For unit files placed in subdirectories within 65 /etc/containers/systemd/user/${UID}/ and the other user unit search paths, 66 Quadlet will recursively search and run the unit files present in these subdirectories. 67 68 Note: When a Quadlet is starting, Podman often pulls one more container images which may take a considerable amount of time. 69 Systemd defaults service start time to 90 seconds, or fails the service. Pre-pulling the image or extending 70 the systemd timeout time for the service using the *TimeoutStartSec* Service option can fix the problem. 71 72 Adding the following snippet to a Quadlet file extends the systemd timeout to 15 minutes. 73 74 ``` 75 [Service] 76 TimeoutStartSec=900 77 ``` 78 79 Quadlet requires the use of cgroup v2, use `podman info --format {{.Host.CgroupsVersion}}` to check on the system. 80 81 ### Service Type 82 83 By default, the `Type` field of the `Service` section of the Quadlet file does not need to be set. 84 Quadlet will set it to `notify` for `.container` and `.kube` files, 85 `forking` for `.pod` files, and `oneshot` for `.volume`, `.network` and `.image` files. 86 87 However, `Type` may be explicitly set to `oneshot` for `.container` and `.kube` files when no containers are expected 88 to run once `podman` exits. 89 90 When setting `Type=oneshot`, it is recommended to also set `RemainAfterExit=yes` to prevent the service state 91 from becoming `inactive (dead)` 92 93 Examples for such cases: 94 - `.container` file with an image that exits after their entrypoint has finished 95 `` 96 - `.kube` file pointing to a Kubernetes Yaml file that does not define any containers. E.g. PVCs only 97 98 ### Enabling unit files 99 100 The services created by Podman are considered transient by systemd, which means they don't have the same 101 persistence rules as regular units. In particular, it is not possible to "systemctl enable" them 102 in order for them to become automatically enabled on the next boot. 103 104 To compensate for this, the generator manually applies the `[Install]` section of the container definition 105 unit files during generation, in the same way `systemctl enable` does when run later. 106 107 For example, to start a container on boot, add something like this to the file: 108 109 ``` 110 [Install] 111 WantedBy=default.target 112 ``` 113 114 Currently, only the `Alias`, `WantedBy` and `RequiredBy` keys are supported. 115 116 The Install section can be part of the main file, or it can be in a 117 separate drop-in file as described above. The latter allows you to 118 install an non-enabled unit and then later enabling it by installing 119 the drop-in. 120 121 122 **NOTE:** To express dependencies between containers, use the generated names of the service. In other 123 words `WantedBy=other.service`, not `WantedBy=other.container`. The same is 124 true for other kinds of dependencies, too, like `After=other.service`. 125 126 ### Template files 127 128 Systemd supports a concept of [template files](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Service%20Templates). 129 They are units with names of the form "basename@instancename.service" 130 when they are running, but that can be instantiated multiple times 131 from a single "basename@.service" file. The individual instances can 132 also be different by using drop-in files with the full instance name. 133 134 Quadlets support these in two ways. First of all, a quadlet unit with 135 a template form will generate a systemd service with a template form, 136 and the template systemd service can be used as a regular template. 137 For example, "foo@.container" will generate "foo@.service" and you can 138 then "systemctl start foo@bar.service". 139 140 Secondly, if you make a symlink like "foo@instance.container", that 141 will generate an instantiated template file. When generating this file 142 quadlet will read drop-in files both from the instanced directory 143 (foo@instance.container.d) and the template directory 144 (foo@.container.d). This allows customization of individual instances. 145 146 Instanced template files (like `foo@bar.container`) can be enabled 147 just like non-templated ones. However, templated ones 148 (`foo@.container`) are different, because they need to be 149 instantiated. If the `[Install]` section contains a `DefaultInstance=` 150 key, then that instance will be enabled, but if not, nothing will 151 happen and the options will only be used as the default for units 152 that are instantiated using symlinks. 153 154 An example template file `sleep@.container` might look like this: 155 156 ``` 157 [Unit] 158 Description=A templated sleepy container 159 160 [Container] 161 Image=quay.io/fedora/fedora 162 Exec=sleep %i 163 164 [Service] 165 # Restart service when sleep finishes 166 Restart=always 167 168 [Install] 169 WantedBy=multi-user.target 170 DefaultInstance=100 171 ``` 172 173 If this is installed, then on boot there will be a `sleep@100.service` 174 running that sleeps for 100 seconds. You can then do something like 175 `systemctl start sleep@50.service` to start another instance that 176 sleeps 50 seconds, or alternatively another service can start it via a 177 dependency like `Wants=sleep@50.service`. 178 179 In addition, if you do `ln -s sleep@.container sleep@10.container` you 180 will also have a 10 second sleep running at boot. And, if you want 181 that particular instance to be running with another image, you can 182 create a drop-in file like `sleep@10.container.d/10-image.conf`: 183 ``` 184 [Container] 185 Image=quay.io/centos/centos 186 ``` 187 188 ### Debugging unit files 189 190 After placing the unit file in one of the unit search paths (mentioned 191 above), you can start it with `systemctl start {--user}`. If it fails 192 with "Failed to start example.service: Unit example.service not 193 found.", then it is possible that you used incorrect syntax or you 194 used an option from a newer version of Podman Quadlet and the 195 generator failed to create a service file. 196 197 View the generated files and/or error messages with: 198 ``` 199 /usr/lib/systemd/system-generators/podman-system-generator {--user} --dryrun 200 ``` 201 202 #### Debugging a limited set of unit files 203 204 If you would like to debug a limited set of unit files, you can copy them to a separate directory and set the 205 `QUADLET_UNIT_DIRS` environment variable to this directory when running the command below: 206 207 ``` 208 QUADLET_UNIT_DIRS=<Directory> /usr/lib/systemd/system-generators/podman-system-generator {--user} --dryrun 209 ``` 210 211 This will instruct Quadlet to look for units in this directory instead of the common ones and by 212 that limit the output to only the units you are debugging. 213 214 ## Container units [Container] 215 216 Container units are named with a `.container` extension and contain a `[Container]` section describing 217 the container that is run as a service. The resulting service file contains a line like 218 `ExecStart=podman run … image-name`, and most of the keys in this section control the command-line 219 options passed to Podman. However, some options also affect the details of how systemd is set up to run and 220 interact with the container. 221 222 By default, the Podman container has the same name as the unit, but with a `systemd-` prefix, i.e. 223 a `$name.container` file creates a `$name.service` unit and a `systemd-$name` Podman container. The 224 `ContainerName` option allows for overriding this default name with a user-provided one. 225 226 There is only one required key, `Image`, which defines the container image the service runs. 227 228 Valid options for `[Container]` are listed below: 229 230 | **[Container] options** | **podman run equivalent** | 231 |--------------------------------------|------------------------------------------------------| 232 | AddCapability=CAP | --cap-add CAP | 233 | AddDevice=/dev/foo | --device /dev/foo | 234 | Annotation="XYZ" | --annotation "XYZ" | 235 | AutoUpdate=registry | --label "io.containers.autoupdate=registry" | 236 | ContainerName=name | --name name | 237 | ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf | 238 | DNS=192.168.55.1 | --dns=192.168.55.1 | 239 | DNSOption=ndots:1 | --dns-option=ndots:1 | 240 | DNSSearch=foo.com | --dns-search=foo.com | 241 | DropCapability=CAP | --cap-drop=CAP | 242 | Entrypoint=/foo.sh | --entrypoint=/foo.sh | 243 | Environment=foo=bar | --env foo=bar | 244 | EnvironmentFile=/tmp/env | --env-file /tmp/env | 245 | EnvironmentHost=true | --env-host | 246 | Exec=/usr/bin/command | Command after image specification - /usr/bin/command | 247 | ExposeHostPort=50-59 | --expose 50-59 | 248 | GIDMap=0:10000:10 | --gidmap=0:10000:10 | 249 | GlobalArgs=--log-level=debug | --log-level=debug | 250 | Group=1234 | --user UID:1234 | 251 | GroupAdd=keep-groups | --group-add=keep-groups | 252 | HealthCmd=/usr/bin/command | --health-cmd=/usr/bin/command | 253 | HealthInterval=2m | --health-interval=2m | 254 | HealthOnFailure=kill | --health-on-failure=kill | 255 | HealthRetries=5 | --health-retries=5 | 256 | HealthStartPeriod=1m | --health-start-period=period=1m | 257 | HealthStartupCmd=command | --health-startup-cmd=command | 258 | HealthStartupInterval=1m | --health-startup-interval=1m | 259 | HealthStartupRetries=8 | --health-startup-retries=8 | 260 | HealthStartupSuccess=2 | --health-startup-success=2 | 261 | HealthStartupTimeout=1m33s | --health-startup-timeout=1m33s | 262 | HealthTimeout=20s | --health-timeout=20s | 263 | HostName=new-host-name | --hostname="new-host-name" | 264 | Image=ubi8 | Image specification - ubi8 | 265 | IP=192.5.0.1 | --ip 192.5.0.1 | 266 | IP6=2001:db8::1 | --ip6 2001:db8::1 | 267 | Label="XYZ" | --label "XYZ" | 268 | LogDriver=journald | --log-driver journald | 269 | Mask=/proc/sys/foo\:/proc/sys/bar | --security-opt mask=/proc/sys/foo:/proc/sys/bar | 270 | Mount=type=... | --mount type=... | 271 | Network=host | --net host | 272 | NoNewPrivileges=true | --security-opt no-new-privileges | 273 | Notify=true | --sdnotify container | 274 | PidsLimit=10000 | --pids-limit 10000 | 275 | Pod=pod-name | --pod=pod-name | 276 | PodmanArgs=--add-host foobar | --add-host foobar | 277 | PublishPort=50-59 | --publish 50-59 | 278 | Pull=never | --pull=never | 279 | ReadOnly=true | --read-only | 280 | ReadOnlyTmpfs=true | --read-only-tmpfs | 281 | Rootfs=/var/lib/rootfs | --rootfs /var/lib/rootfs | 282 | RunInit=true | --init | 283 | SeccompProfile=/tmp/s.json | --security-opt seccomp=/tmp/s.json | 284 | Secret=secret | --secret=secret[,opt=opt ...] | 285 | SecurityLabelDisable=true | --security-opt label=disable | 286 | SecurityLabelFileType=usr_t | --security-opt label=filetype:usr_t | 287 | SecurityLabelLevel=s0:c1,c2 | --security-opt label=level:s0:c1,c2 | 288 | SecurityLabelNested=true | --security-opt label=nested | 289 | SecurityLabelType=spc_t | --security-opt label=type:spc_t | 290 | ShmSize=100m | --shm-size=100m | 291 | StopTimeout=20 | --stop-timeout=20 | 292 | SubGIDMap=gtest | --subgidname=gtest | 293 | SubUIDMap=utest | --subuidname=utest | 294 | Sysctl=name=value | --sysctl=name=value | 295 | Timezone=local | --tz local | 296 | Tmpfs=/work | --tmpfs /work | 297 | UIDMap=0:10000:10 | --uidmap=0:10000:10 | 298 | Ulimit=nofile=1000:10000 | --ulimit nofile=1000:10000 | 299 | Unmask=ALL | --security-opt unmask=ALL | 300 | User=bin | --user bin | 301 | UserNS=keep-id:uid=200,gid=210 | --userns keep-id:uid=200,gid=210 | 302 | Volume=/source:/dest | --volume /source:/dest | 303 | WorkingDir=$HOME | --workdir $HOME | 304 305 Description of `[Container]` section are: 306 307 ### `AddCapability=` 308 309 Add these capabilities, in addition to the default Podman capability set, to the container. 310 311 This is a space separated list of capabilities. This key can be listed multiple times. 312 313 For example: 314 ``` 315 AddCapability=CAP_DAC_OVERRIDE CAP_IPC_OWNER 316 ``` 317 318 ### `AddDevice=` 319 320 Adds a device node from the host into the container. The format of this is 321 `HOST-DEVICE[:CONTAINER-DEVICE][:PERMISSIONS]`, where `HOST-DEVICE` is the path of 322 the device node on the host, `CONTAINER-DEVICE` is the path of the device node in 323 the container, and `PERMISSIONS` is a list of permissions combining 'r' for read, 324 'w' for write, and 'm' for mknod(2). The `-` prefix tells Quadlet to add the device 325 only if it exists on the host. 326 327 This key can be listed multiple times. 328 329 ### `Annotation=` 330 331 Set one or more OCI annotations on the container. The format is a list of `key=value` items, 332 similar to `Environment`. 333 334 This key can be listed multiple times. 335 336 ### `AutoUpdate=` 337 338 Indicates whether the container will be auto-updated ([podman-auto-update(1)](podman-auto-update.1.md)). The following values are supported: 339 340 * `registry`: Requires a fully-qualified image reference (e.g., quay.io/podman/stable:latest) to be used to create the container. This enforcement is necessary to know which image to actually check and pull. If an image ID was used, Podman does not know which image to check/pull anymore. 341 342 * `local`: Tells Podman to compare the image a container is using to the image with its raw name in local storage. If an image is updated locally, Podman simply restarts the systemd unit executing the container. 343 344 ### `ContainerName=` 345 346 The (optional) name of the Podman container. If this is not specified, the default value 347 of `systemd-%N` is used, which is the same as the service name but with a `systemd-` 348 prefix to avoid conflicts with user-managed containers. 349 350 ### `ContainersConfModule=` 351 352 Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option. 353 354 This key can be listed multiple times. 355 356 ### `DNS=` 357 358 Set network-scoped DNS resolver/nameserver for containers in this network. 359 360 This key can be listed multiple times. 361 362 ### `DNSOption=` 363 364 Set custom DNS options. 365 366 This key can be listed multiple times. 367 368 ### `DNSSearch=` 369 370 Set custom DNS search domains. Use **DNSSearch=.** to remove the search domain. 371 372 This key can be listed multiple times. 373 374 ### `DropCapability=` 375 376 Drop these capabilities from the default podman capability set, or `all` to drop all capabilities. 377 378 This is a space separated list of capabilities. This key can be listed multiple times. 379 380 For example: 381 ``` 382 DropCapability=CAP_DAC_OVERRIDE CAP_IPC_OWNER 383 ``` 384 385 ### `Entrypoint=` 386 387 Override the default ENTRYPOINT from the image. 388 Equivalent to the Podman `--entrypoint` option. 389 Specify multi option commands in the form of a json string. 390 391 ### `Environment=` 392 393 Set an environment variable in the container. This uses the same format as 394 [services in systemd](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Environment=) 395 and can be listed multiple times. 396 397 ### `EnvironmentFile=` 398 399 Use a line-delimited file to set environment variables in the container. 400 The path may be absolute or relative to the location of the unit file. 401 This key may be used multiple times, and the order persists when passed to `podman run`. 402 403 ### `EnvironmentHost=` 404 405 Use the host environment inside of the container. 406 407 ### `Exec=` 408 409 If this is set then it defines what command line to run in the container. If it is not set the 410 default entry point of the container image is used. The format is the same as for 411 [systemd command lines](https://www.freedesktop.org/software/systemd/man/systemd.service.html#Command%20lines). 412 413 ### `ExposeHostPort=` 414 415 Exposes a port, or a range of ports (e.g. `50-59`), from the host to the container. Equivalent 416 to the Podman `--expose` option. 417 418 This key can be listed multiple times. 419 420 ### `GIDMap=` 421 422 Run the container in a new user namespace using the supplied GID mapping. 423 Equivalent to the Podman `--gidmap` option. 424 425 This key can be listed multiple times. 426 427 ### `GlobalArgs=` 428 429 This key contains a list of arguments passed directly between `podman` and `run` 430 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 431 of what unexpected interactions can be caused by these arguments, it is not recommended to use 432 this option. 433 434 The format of this is a space separated list of arguments, which can optionally be individually 435 escaped to allow inclusion of whitespace and other control characters. 436 437 This key can be listed multiple times. 438 439 ### `Group=` 440 441 The (numeric) GID to run as inside the container. This does not need to match the GID on the host, 442 which can be modified with `UsersNS`, but if that is not specified, this GID is also used on the host. 443 444 ### `GroupAdd=` 445 446 Assign additional groups to the primary user running within the container process. Also supports the `keep-groups` special flag. 447 Equivalent to the Podman `--group-add` option. 448 449 ### `HealthCmd=` 450 451 Set or alter a healthcheck command for a container. A value of none disables existing healthchecks. 452 Equivalent to the Podman `--health-cmd` option. 453 454 ### `HealthInterval=` 455 456 Set an interval for the healthchecks. An interval of disable results in no automatic timer setup. 457 Equivalent to the Podman `--health-interval` option. 458 459 ### `HealthOnFailure=` 460 461 Action to take once the container transitions to an unhealthy state. 462 The "kill" action in combination integrates best with systemd. Once 463 the container turns unhealthy, it gets killed, and systemd restarts the 464 service. 465 Equivalent to the Podman `--health-on-failure` option. 466 467 ### `HealthRetries=` 468 469 The number of retries allowed before a healthcheck is considered to be unhealthy. 470 Equivalent to the Podman `--health-retries` option. 471 472 ### `HealthStartPeriod=` 473 474 The initialization time needed for a container to bootstrap. 475 Equivalent to the Podman `--health-start-period` option. 476 477 ### `HealthStartupCmd=` 478 479 Set a startup healthcheck command for a container. 480 Equivalent to the Podman `--health-startup-cmd` option. 481 482 ### `HealthStartupInterval=` 483 484 Set an interval for the startup healthcheck. An interval of disable results in no automatic timer setup. 485 Equivalent to the Podman `--health-startup-interval` option. 486 487 ### `HealthStartupRetries=` 488 489 The number of attempts allowed before the startup healthcheck restarts the container. 490 Equivalent to the Podman `--health-startup-retries` option. 491 492 ### `HealthStartupSuccess=` 493 494 The number of successful runs required before the startup healthcheck succeeds and the regular healthcheck begins. 495 Equivalent to the Podman `--health-startup-success` option. 496 497 ### `HealthStartupTimeout=` 498 499 The maximum time a startup healthcheck command has to complete before it is marked as failed. 500 Equivalent to the Podman `--health-startup-timeout` option. 501 502 ### `HealthTimeout=` 503 504 The maximum time allowed to complete the healthcheck before an interval is considered failed. 505 Equivalent to the Podman `--health-timeout` option. 506 507 ### `HostName=` 508 509 Sets the host name that is available inside the container. 510 Equivalent to the Podman `--hostname` option. 511 512 ### `Image=` 513 514 The image to run in the container. 515 It is recommended to use a fully qualified image name rather than a short name, both for 516 performance and robustness reasons. 517 518 The format of the name is the same as when passed to `podman pull`. So, it supports using 519 `:tag` or digests to guarantee the specific image version. 520 521 As a special case, if the `name` of the image ends with `.image`, Quadlet will use the image 522 pulled by the corresponding `.image` file, and the generated systemd service contains 523 a dependency on the `$name-image.service`. 524 Note that the corresponding `.image` file must exist. 525 526 ### `IP=` 527 528 Specify a static IPv4 address for the container, for example **10.88.64.128**. 529 Equivalent to the Podman `--ip` option. 530 531 ### `IP6=` 532 533 Specify a static IPv6 address for the container, for example **fd46:db93:aa76:ac37::10**. 534 Equivalent to the Podman `--ip6` option. 535 536 ### `Label=` 537 538 Set one or more OCI labels on the container. The format is a list of `key=value` items, 539 similar to `Environment`. 540 541 This key can be listed multiple times. 542 543 ### `LogDriver=` 544 545 Set the log-driver used by Podman when running the container. 546 Equivalent to the Podman `--log-driver` option. 547 548 ### `Mask=` 549 550 Specify the paths to mask separated by a colon. `Mask=/path/1:/path/2`. A masked path cannot be accessed inside the container. 551 552 ### `Mount=` 553 554 Attach a filesystem mount to the container. 555 This is equivalent to the Podman `--mount` option, and 556 generally has the form `type=TYPE,TYPE-SPECIFIC-OPTION[,...]`. 557 558 As a special case, for `type=volume` if `source` ends with `.volume`, a Podman named volume called 559 `systemd-$name` is used as the source, and the generated systemd service contains 560 a dependency on the `$name-volume.service`. Such a volume can be automatically be lazily 561 created by using a `$name.volume` Quadlet file. 562 563 This key can be listed multiple times. 564 565 ### `Network=` 566 567 Specify a custom network for the container. This has the same format as the `--network` option 568 to `podman run`. For example, use `host` to use the host network in the container, or `none` to 569 not set up networking in the container. 570 571 As a special case, if the `name` of the network ends with `.network`, a Podman network called 572 `systemd-$name` is used, and the generated systemd service contains 573 a dependency on the `$name-network.service`. Such a network can be automatically 574 created by using a `$name.network` Quadlet file. 575 576 This key can be listed multiple times. 577 578 ### `NoNewPrivileges=` (defaults to `no`) 579 580 If enabled, this disables the container processes from gaining additional privileges via things like 581 setuid and file capabilities. 582 583 ### `Notify=` (defaults to `no`) 584 585 By default, Podman is run in such a way that the systemd startup notify command is handled by 586 the container runtime. In other words, the service is deemed started when the container runtime 587 starts the child in the container. However, if the container application supports 588 [sd_notify](https://www.freedesktop.org/software/systemd/man/sd_notify.html), then setting 589 `Notify` to true passes the notification details to the container allowing it to notify 590 of startup on its own. 591 592 In addition, setting `Notify` to `healthy` will postpone startup notifications until such time as 593 the container is marked healthy, as determined by Podman healthchecks. Note that this requires 594 setting up a container healthcheck, see the `HealthCmd` option for more. 595 596 ### `PidsLimit=` 597 598 Tune the container's pids limit. 599 This is equivalent to the Podman `--pids-limit` option. 600 601 ### `Pod=` 602 603 Specify a Quadlet `.pod` unit to link the container to. 604 The value must take the form of `<name>.pod` and the `.pod` unit must exist. 605 606 Quadlet will add all the necessary parameters to link between the container and the pod and between their corresponding services. 607 608 609 ### `PodmanArgs=` 610 611 This key contains a list of arguments passed directly to the end of the `podman run` command 612 in the generated file (right before the image name in the command line). It can be used to 613 access Podman features otherwise unsupported by the generator. Since the generator is unaware 614 of what unexpected interactions can be caused by these arguments, it is not recommended to use 615 this option. 616 617 The format of this is a space separated list of arguments, which can optionally be individually 618 escaped to allow inclusion of whitespace and other control characters. 619 620 This key can be listed multiple times. 621 622 ### `PublishPort=` 623 624 Exposes a port, or a range of ports (e.g. `50-59`), from the container to the host. Equivalent 625 to the Podman `--publish` option. The format is similar to the Podman options, which is of 626 the form `ip:hostPort:containerPort`, `ip::containerPort`, `hostPort:containerPort` or 627 `containerPort`, where the number of host and container ports must be the same (in the case 628 of a range). 629 630 If the IP is set to 0.0.0.0 or not set at all, the port is bound on all IPv4 addresses on 631 the host; use [::] for IPv6. 632 633 Note that not listing a host port means that Podman automatically selects one, and it 634 may be different for each invocation of service. This makes that a less useful option. The 635 allocated port can be found with the `podman port` command. 636 637 This key can be listed multiple times. 638 639 ### `Pull=` 640 641 Set the image pull policy. 642 This is equivalent to the Podman `--pull` option 643 644 ### `ReadOnly=` (defaults to `no`) 645 646 If enabled, makes the image read-only. 647 648 ### `ReadOnlyTmpfs=` (defaults to `yes`) 649 650 If ReadOnly is set to `yes`, mount a read-write tmpfs on /dev, /dev/shm, /run, /tmp, and /var/tmp. 651 652 ### `Rootfs=` 653 654 The rootfs to use for the container. Rootfs points to a directory on the system that contains the content to be run within the container. This option conflicts with the `Image` option. 655 656 The format of the rootfs is the same as when passed to `podman run --rootfs`, so it supports overlay mounts as well. 657 658 Note: On SELinux systems, the rootfs needs the correct label, which is by default unconfined_u:object_r:container_file_t:s0. 659 660 ### `RunInit=` (default to `no`) 661 662 If enabled, the container has a minimal init process inside the 663 container that forwards signals and reaps processes. 664 665 ### `SeccompProfile=` 666 667 Set the seccomp profile to use in the container. If unset, the default podman profile is used. 668 Set to either the pathname of a json file, or `unconfined` to disable the seccomp filters. 669 670 ### `Secret=` 671 672 Use a Podman secret in the container either as a file or an environment variable. 673 This is equivalent to the Podman `--secret` option and generally has the form `secret[,opt=opt ...]` 674 675 ### `SecurityLabelDisable=` 676 677 Turn off label separation for the container. 678 679 ### `SecurityLabelFileType=` 680 681 Set the label file type for the container files. 682 683 ### `SecurityLabelLevel=` 684 685 Set the label process level for the container processes. 686 687 ### `SecurityLabelNested=` 688 689 Allow SecurityLabels to function within the container. This allows separation of containers created within the container. 690 691 ### `SecurityLabelType=` 692 693 Set the label process type for the container processes. 694 695 ### `ShmSize=` 696 697 Size of /dev/shm. 698 699 This is equivalent to the Podman `--shm-size` option and generally has the form `number[unit]` 700 701 ### `StopTimeout=` 702 703 Seconds to wait before forcibly stopping the container. 704 705 Note, this value should be lower than the actual systemd unit timeout to make sure the podman rm command is not killed by systemd. 706 707 This is equivalent to the Podman `--stop-timeout` option 708 709 ### `SubGIDMap=` 710 711 Run the container in a new user namespace using the map with name in the /etc/subgid file. 712 Equivalent to the Podman `--subgidname` option. 713 714 ### `SubUIDMap=` 715 716 Run the container in a new user namespace using the map with name in the /etc/subuid file. 717 Equivalent to the Podman `--subuidname` option. 718 719 ### `Sysctl=` 720 721 Configures namespaced kernel parameters for the container. The format is `Sysctl=name=value`. 722 723 This is a space separated list of kernel parameters. This key can be listed multiple times. 724 725 For example: 726 ``` 727 Sysctl=net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.all.use_tempaddr=1 728 ``` 729 730 ### `Timezone=` (if unset uses system-configured default) 731 732 The timezone to run the container in. 733 734 ### `Tmpfs=` 735 736 Mount a tmpfs in the container. This is equivalent to the Podman `--tmpfs` option, and 737 generally has the form `CONTAINER-DIR[:OPTIONS]`. 738 739 This key can be listed multiple times. 740 741 ### `UIDMap=` 742 743 Run the container in a new user namespace using the supplied UID mapping. 744 Equivalent to the Podman `--uidmap` option. 745 746 This key can be listed multiple times. 747 748 ### `Ulimit=` 749 750 Ulimit options. Sets the ulimits values inside of the container. 751 752 This key can be listed multiple times. 753 754 ### `Unmask=` 755 756 Specify the paths to unmask separated by a colon. unmask=ALL or /path/1:/path/2, or shell expanded paths (/proc/*): 757 758 If set to `ALL`, Podman will unmask all the paths that are masked or made read-only by default. 759 760 The default masked paths are /proc/acpi, /proc/kcore, /proc/keys, /proc/latency_stats, /proc/sched_debug, /proc/scsi, /proc/timer_list, /proc/timer_stats, /sys/firmware, and /sys/fs/selinux. 761 762 The default paths that are read-only are /proc/asound, /proc/bus, /proc/fs, /proc/irq, /proc/sys, /proc/sysrq-trigger, /sys/fs/cgroup. 763 764 ### `User=` 765 766 The (numeric) UID to run as inside the container. This does not need to match the UID on the host, 767 which can be modified with `UserNS`, but if that is not specified, this UID is also used on the host. 768 769 ### `UserNS=` 770 771 Set the user namespace mode for the container. This is equivalent to the Podman `--userns` option and 772 generally has the form `MODE[:OPTIONS,...]`. 773 774 ### `Volume=` 775 776 Mount a volume in the container. This is equivalent to the Podman `--volume` option, and 777 generally has the form `[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]`. 778 779 If `SOURCE-VOLUME` starts with `.`, Quadlet resolves the path relative to the location of the unit file. 780 781 As a special case, if `SOURCE-VOLUME` ends with `.volume`, a Podman named volume called 782 `systemd-$name` is used as the source, and the generated systemd service contains 783 a dependency on the `$name-volume.service`. Such a volume can be automatically be lazily 784 created by using a `$name.volume` Quadlet file. 785 786 This key can be listed multiple times. 787 788 ### `WorkingDir=` 789 790 Working directory inside the container. 791 792 The default working directory for running binaries within a container is the root directory (/). The image developer can set a different default with the WORKDIR instruction. This option overrides the working directory by using the -w option. 793 794 ## Pod units [Pod] 795 796 Pod units are named with a `.pod` extension and contain a `[Pod]` section describing 797 the pod that is created and run as a service. The resulting service file contains a line like 798 `ExecStartPre=podman pod create …`, and most of the keys in this section control the command-line 799 options passed to Podman. 800 801 By default, the Podman pod has the same name as the unit, but with a `systemd-` prefix, i.e. 802 a `$name.pod` file creates a `$name-pod.service` unit and a `systemd-$name` Podman pod. The 803 `PodName` option allows for overriding this default name with a user-provided one. 804 805 Valid options for `[Pod]` are listed below: 806 807 | **[Pod] options** | **podman container create equivalent** | 808 |-------------------------------------|----------------------------------------| 809 | ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf | 810 | GlobalArgs=--log-level=debug | --log-level=debug | 811 | Network=host | --network host | 812 | PodmanArgs=\-\-cpus=2 | --cpus=2 | 813 | PodName=name | --name=name | 814 | PublishPort=50-59 | --publish 50-59 | 815 | Volume=/source:/dest | --volume /source:/dest | 816 817 Supported keys in the `[Pod]` section are: 818 819 ### `ContainersConfModule=` 820 821 Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option. 822 823 This key can be listed multiple times. 824 825 ### `GlobalArgs=` 826 827 This key contains a list of arguments passed directly between `podman` and `pod` 828 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 829 of what unexpected interactions can be caused by these arguments, it is not recommended to use 830 this option. 831 832 The format of this is a space separated list of arguments, which can optionally be individually 833 escaped to allow inclusion of whitespace and other control characters. 834 835 This key can be listed multiple times. 836 837 ### `Network=` 838 839 Specify a custom network for the pod. 840 This has the same format as the `--network` option to `podman pod create`. 841 For example, use `host` to use the host network in the pod, or `none` to not set up networking in the pod. 842 843 As a special case, if the `name` of the network ends with `.network`, Quadlet will look for the corresponding `.network` Quadlet unit. 844 If found, Quadlet will use the name of the Network set in the Unit, otherwise, `systemd-$name` is used. 845 The generated systemd service contains a dependency on the service unit generated for that `.network` unit, 846 or on `$name-network.service` if the `.network` unit is not found 847 848 This key can be listed multiple times. 849 850 ### `PodmanArgs=` 851 852 This key contains a list of arguments passed directly to the end of the `podman pod create` command 853 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 854 of what unexpected interactions can be caused by these arguments, is not recommended to use 855 this option. 856 857 The format of this is a space separated list of arguments, which can optionally be individually 858 escaped to allow inclusion of whitespace and other control characters. 859 860 This key can be listed multiple times. 861 862 ### `PodName=` 863 864 The (optional) name of the Podman pod. If this is not specified, the default value 865 of `systemd-%N` is used, which is the same as the service name but with a `systemd-` 866 prefix to avoid conflicts with user-managed containers. 867 868 Please note that pods and containers cannot have the same name. 869 So, if PodName is set, it must not conflict with any container. 870 871 ### `PublishPort=` 872 873 Exposes a port, or a range of ports (e.g. `50-59`), from the pod to the host. Equivalent 874 to the Podman `--publish` option. The format is similar to the Podman options, which is of 875 the form `ip:hostPort:containerPort`, `ip::containerPort`, `hostPort:containerPort` or 876 `containerPort`, where the number of host and container ports must be the same (in the case 877 of a range). 878 879 If the IP is set to 0.0.0.0 or not set at all, the port is bound on all IPv4 addresses on 880 the host; use [::] for IPv6. 881 882 Note that not listing a host port means that Podman automatically selects one, and it 883 may be different for each invocation of service. This makes that a less useful option. The 884 allocated port can be found with the `podman port` command. 885 886 When using `host` networking via `Network=host`, the `PublishPort=` option cannot be used. 887 888 This key can be listed multiple times. 889 890 ### `Volume=` 891 892 Mount a volume in the pod. This is equivalent to the Podman `--volume` option, and 893 generally has the form `[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]`. 894 895 If `SOURCE-VOLUME` starts with `.`, Quadlet resolves the path relative to the location of the unit file. 896 897 As a special case, if `SOURCE-VOLUME` ends with `.volume`, Quadlet will look for the corresponding `.volume` Quadlet unit. 898 If found, Quadlet will use the name of the Volume set in the Unit, otherwise, `systemd-$name` is used. 899 The generated systemd service contains a dependency on the service unit generated for that `.volume` unit, 900 or on `$name-volume.service` if the `.volume` unit is not found 901 902 This key can be listed multiple times. 903 904 ## Kube units [Kube] 905 906 Kube units are named with a `.kube` extension and contain a `[Kube]` section describing 907 how `podman kube play` runs as a service. The resulting service file contains a line like 908 `ExecStart=podman kube play … file.yml`, and most of the keys in this section control the command-line 909 options passed to Podman. However, some options also affect the details of how systemd is set up to run and 910 interact with the container. 911 912 There is only one required key, `Yaml`, which defines the path to the Kubernetes YAML file. 913 914 Valid options for `[Kube]` are listed below: 915 916 | **[Kube] options** | **podman kube play equivalent** | 917 | ------------------------------------| -----------------------------------------------------------------| 918 | AutoUpdate=registry | --annotation "io.containers.autoupdate=registry" | 919 | ConfigMap=/tmp/config.map | --config-map /tmp/config.map | 920 | ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf | 921 | ExitCodePropagation=how | How to propagate container error status | 922 | GlobalArgs=--log-level=debug | --log-level=debug | 923 | KubeDownForce=true | --force (for `podman kube down`) | 924 | LogDriver=journald | --log-driver journald | 925 | Network=host | --net host | 926 | PodmanArgs=\-\-annotation=key=value | --annotation=key=value | 927 | PublishPort=59-60 | --publish=59-60 | 928 | SetWorkingDirectory=yaml | Set `WorkingDirectory` of unit file to location of the YAML file | 929 | UserNS=keep-id:uid=200,gid=210 | --userns keep-id:uid=200,gid=210 | 930 | Yaml=/tmp/kube.yaml | podman kube play /tmp/kube.yaml | 931 932 Supported keys in the `[Kube]` section are: 933 934 ### `AutoUpdate=` 935 936 Indicates whether containers will be auto-updated ([podman-auto-update(1)](podman-auto-update.1.md)). AutoUpdate can be specified multiple times. The following values are supported: 937 938 * `registry`: Requires a fully-qualified image reference (e.g., quay.io/podman/stable:latest) to be used to create the container. This enforcement is necessary to know which images to actually check and pull. If an image ID was used, Podman does not know which image to check/pull anymore. 939 940 * `local`: Tells Podman to compare the image a container is using to the image with its raw name in local storage. If an image is updated locally, Podman simply restarts the systemd unit executing the Kubernetes Quadlet. 941 942 * `name/(local|registry)`: Tells Podman to perform the `local` or `registry` autoupdate on the specified container name. 943 944 ### `ConfigMap=` 945 946 Pass the Kubernetes ConfigMap YAML path to `podman kube play` via the `--configmap` argument. 947 Unlike the `configmap` argument, the value may contain only one path but 948 it may be absolute or relative to the location of the unit file. 949 950 This key may be used multiple times 951 952 ### `ContainersConfModule=` 953 954 Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option. 955 956 This key can be listed multiple times. 957 958 ### `ExitCodePropagation=` 959 960 Control how the main PID of the systemd service should exit. The following values are supported: 961 - `all`: exit non-zero if all containers have failed (i.e., exited non-zero) 962 - `any`: exit non-zero if any container has failed 963 - `none`: exit zero and ignore failed containers 964 965 The current default value is `none`. 966 967 ### `GlobalArgs=` 968 969 This key contains a list of arguments passed directly between `podman` and `kube` 970 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 971 of what unexpected interactions can be caused by these arguments, it is not recommended to use 972 this option. 973 974 The format of this is a space separated list of arguments, which can optionally be individually 975 escaped to allow inclusion of whitespace and other control characters. 976 977 This key can be listed multiple times. 978 979 ### `KubeDownForce=` 980 981 Remove all resources, including volumes, when calling `podman kube down`. 982 Equivalent to the Podman `--force` option. 983 984 ### `LogDriver=` 985 986 Set the log-driver Podman uses when running the container. 987 Equivalent to the Podman `--log-driver` option. 988 989 ### `Network=` 990 991 Specify a custom network for the container. This has the same format as the `--network` option 992 to `podman kube play`. For example, use `host` to use the host network in the container, or `none` to 993 not set up networking in the container. 994 995 As a special case, if the `name` of the network ends with `.network`, a Podman network called 996 `systemd-$name` is used, and the generated systemd service contains 997 a dependency on the `$name-network.service`. Such a network can be automatically 998 created by using a `$name.network` Quadlet file. 999 1000 This key can be listed multiple times. 1001 1002 ### `PodmanArgs=` 1003 1004 This key contains a list of arguments passed directly to the end of the `podman kube play` command 1005 in the generated file (right before the path to the yaml file in the command line). It can be used to 1006 access Podman features otherwise unsupported by the generator. Since the generator is unaware 1007 of what unexpected interactions can be caused by these arguments, is not recommended to use 1008 this option. 1009 1010 The format of this is a space separated list of arguments, which can optionally be individually 1011 escaped to allow inclusion of whitespace and other control characters. 1012 1013 This key can be listed multiple times. 1014 1015 ### `PublishPort=` 1016 1017 Exposes a port, or a range of ports (e.g. `50-59`), from the container to the host. Equivalent 1018 to the `podman kube play`'s `--publish` option. The format is similar to the Podman options, which is of 1019 the form `ip:hostPort:containerPort`, `ip::containerPort`, `hostPort:containerPort` or 1020 `containerPort`, where the number of host and container ports must be the same (in the case 1021 of a range). 1022 1023 If the IP is set to 0.0.0.0 or not set at all, the port is bound on all IPv4 addresses on 1024 the host; use [::] for IPv6. 1025 1026 The list of published ports specified in the unit file is merged with the list of ports specified 1027 in the Kubernetes YAML file. If the same container port and protocol is specified in both, the 1028 entry from the unit file takes precedence 1029 1030 This key can be listed multiple times. 1031 1032 ### `SetWorkingDirectory=` 1033 1034 Set the `WorkingDirectory` field of the `Service` group of the Systemd service unit file. 1035 Used to allow `podman kube play` to correctly resolve relative paths. 1036 Supported values are `yaml` and `unit` to set the working directory to that of the YAML or Quadlet Unit file respectively. 1037 1038 Alternatively, users can explicitly set the `WorkingDirectory` field of the `Service` group in the `.kube` file. 1039 Please note that if the `WorkingDirectory` field of the `Service` group is set, 1040 Quadlet will not set it even if `SetWorkingDirectory` is set 1041 1042 ### `UserNS=` 1043 1044 Set the user namespace mode for the container. This is equivalent to the Podman `--userns` option and 1045 generally has the form `MODE[:OPTIONS,...]`. 1046 1047 ### `Yaml=` 1048 1049 The path, absolute or relative to the location of the unit file, to the Kubernetes YAML file to use. 1050 1051 ## Network units [Network] 1052 1053 Network files are named with a `.network` extension and contain a section `[Network]` describing the 1054 named Podman network. The generated service is a one-time command that ensures that the network 1055 exists on the host, creating it if needed. 1056 1057 By default, the Podman network has the same name as the unit, but with a `systemd-` prefix, i.e. for 1058 a network file named `$NAME.network`, the generated Podman network is called `systemd-$NAME`, and 1059 the generated service file is `$NAME-network.service`. The `NetworkName` option allows for 1060 overriding this default name with a user-provided one. 1061 1062 Please note that stopping the corresponding service will not remove the podman network. 1063 In addition, updating an existing network is not supported. 1064 In order to update the network parameters you will first need to manually remove the podman network and then restart the service. 1065 1066 Using network units allows containers to depend on networks being automatically pre-created. This is 1067 particularly interesting when using special options to control network creation, as Podman otherwise creates networks with the default options. 1068 1069 Valid options for `[Network]` are listed below: 1070 1071 | **[Network] options** | **podman network create equivalent** | 1072 |-------------------------------------|--------------------------------------| 1073 | ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf | 1074 | DisableDNS=true | --disable-dns | 1075 | DNS=192.168.55.1 | --dns=192.168.55.1 | 1076 | Driver=bridge | --driver bridge | 1077 | Gateway=192.168.55.3 | --gateway 192.168.55.3 | 1078 | GlobalArgs=--log-level=debug | --log-level=debug | 1079 | Internal=true | --internal | 1080 | IPAMDriver=dhcp | --ipam-driver dhcp | 1081 | IPRange=192.168.55.128/25 | --ip-range 192.168.55.128/25 | 1082 | IPv6=true | --ipv6 | 1083 | Label="XYZ" | --label "XYZ" | 1084 | NetworkName=foo | podman network create foo | 1085 | Options=isolate=true | --opt isolate=true | 1086 | PodmanArgs=--dns=192.168.55.1 | --dns=192.168.55.1 | 1087 | Subnet=192.5.0.0/16 | --subnet 192.5.0.0/16 | 1088 1089 Supported keys in `[Network]` section are: 1090 1091 ### `ContainersConfModule=` 1092 1093 Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option. 1094 1095 This key can be listed multiple times. 1096 1097 ### `DisableDNS=` (defaults to `no`) 1098 1099 If enabled, disables the DNS plugin for this network. 1100 1101 This is equivalent to the Podman `--disable-dns` option 1102 1103 ### `DNS=` 1104 1105 Set network-scoped DNS resolver/nameserver for containers in this network. 1106 1107 This key can be listed multiple times. 1108 1109 ### `Driver=` (defaults to `bridge`) 1110 1111 Driver to manage the network. Currently `bridge`, `macvlan` and `ipvlan` are supported. 1112 1113 This is equivalent to the Podman `--driver` option 1114 1115 ### `Gateway=` 1116 1117 Define a gateway for the subnet. If you want to provide a gateway address, you must also provide a subnet option. 1118 1119 This is equivalent to the Podman `--gateway` option 1120 1121 This key can be listed multiple times. 1122 1123 ### `GlobalArgs=` 1124 1125 This key contains a list of arguments passed directly between `podman` and `network` 1126 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 1127 of what unexpected interactions can be caused by these arguments, it is not recommended to use 1128 this option. 1129 1130 The format of this is a space separated list of arguments, which can optionally be individually 1131 escaped to allow inclusion of whitespace and other control characters. 1132 1133 This key can be listed multiple times. 1134 1135 ### `Internal=` (defaults to `no`) 1136 1137 Restrict external access of this network. 1138 1139 This is equivalent to the Podman `--internal` option 1140 1141 ### `IPAMDriver=` 1142 1143 Set the ipam driver (IP Address Management Driver) for the network. Currently `host-local`, `dhcp` and `none` are supported. 1144 1145 This is equivalent to the Podman `--ipam-driver` option 1146 1147 ### `IPRange=` 1148 1149 Allocate container IP from a range. The range must be a either a complete subnet in CIDR notation or be 1150 in the `<startIP>-<endIP>` syntax which allows for a more flexible range compared to the CIDR subnet. 1151 The ip-range option must be used with a subnet option. 1152 1153 This is equivalent to the Podman `--ip-range` option 1154 1155 This key can be listed multiple times. 1156 1157 ### `IPv6=` 1158 1159 Enable IPv6 (Dual Stack) networking. 1160 1161 This is equivalent to the Podman `--ipv6` option 1162 1163 ### `Label=` 1164 1165 Set one or more OCI labels on the network. The format is a list of 1166 `key=value` items, similar to `Environment`. 1167 1168 This key can be listed multiple times. 1169 1170 ### `NetworkName=` 1171 1172 The (optional) name of the Podman network. If this is not specified, the default value of 1173 `systemd-%N` is used, which is the same as the unit name but with a `systemd-` prefix to avoid 1174 conflicts with user-managed networks. 1175 1176 ### `Options=` 1177 1178 Set driver specific options. 1179 1180 This is equivalent to the Podman `--opt` option 1181 1182 ### `PodmanArgs=` 1183 1184 This key contains a list of arguments passed directly to the end of the `podman network create` command 1185 in the generated file (right before the name of the network in the command line). It can be used to 1186 access Podman features otherwise unsupported by the generator. Since the generator is unaware 1187 of what unexpected interactions can be caused by these arguments, is not recommended to use 1188 this option. 1189 1190 The format of this is a space separated list of arguments, which can optionally be individually 1191 escaped to allow inclusion of whitespace and other control characters. 1192 1193 This key can be listed multiple times. 1194 1195 ### `Subnet=` 1196 1197 The subnet in CIDR notation. 1198 1199 This is equivalent to the Podman `--subnet` option 1200 1201 This key can be listed multiple times. 1202 1203 ## Volume units [Volume] 1204 1205 Volume files are named with a `.volume` extension and contain a section `[Volume]` describing the 1206 named Podman volume. The generated service is a one-time command that ensures that the volume 1207 exists on the host, creating it if needed. 1208 1209 By default, the Podman volume has the same name as the unit, but with a `systemd-` prefix, i.e. for 1210 a volume file named `$NAME.volume`, the generated Podman volume is called `systemd-$NAME`, and the 1211 generated service file is `$NAME-volume.service`. The `VolumeName` option allows for overriding this 1212 default name with a user-provided one. 1213 1214 Using volume units allows containers to depend on volumes being automatically pre-created. This is 1215 particularly interesting when using special options to control volume creation, 1216 as Podman otherwise creates volumes with the default options. 1217 1218 Valid options for `[Volume]` are listed below: 1219 1220 | **[Volume] options** | **podman volume create equivalent** | 1221 |-------------------------------------|-------------------------------------------| 1222 | ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf | 1223 | Copy=true | --opt copy | 1224 | Device=tmpfs | --opt device=tmpfs | 1225 | Driver=image | --driver=image | 1226 | GlobalArgs=--log-level=debug | --log-level=debug | 1227 | Group=192 | --opt group=192 | 1228 | Image=quay.io/centos/centos\:latest | --opt image=quay.io/centos/centos\:latest | 1229 | Label="foo=bar" | --label "foo=bar" | 1230 | Options=XYZ | --opt "o=XYZ" | 1231 | PodmanArgs=--driver=image | --driver=image | 1232 | Type=type | Filesystem type of Device | 1233 | User=123 | --opt uid=123 | 1234 | VolumeName=foo | podman volume create foo | 1235 1236 Supported keys in `[Volume]` section are: 1237 1238 ### `ContainersConfModule=` 1239 1240 Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option. 1241 1242 This key can be listed multiple times. 1243 1244 ### `Copy=` (default to `yes`) 1245 1246 If enabled, the content of the image located at the mountpoint of the volume is copied into the 1247 volume on the first run. 1248 1249 ### `Device=` 1250 1251 The path of a device which is mounted for the volume. 1252 1253 ### `Driver=` 1254 1255 Specify the volume driver name. When set to `image`, the `Image` key must also be set. 1256 1257 This is equivalent to the Podman `--driver` option. 1258 1259 ### `GlobalArgs=` 1260 1261 This key contains a list of arguments passed directly between `podman` and `volume` 1262 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 1263 of what unexpected interactions can be caused by these arguments, it is not recommended to use 1264 this option. 1265 1266 The format of this is a space separated list of arguments, which can optionally be individually 1267 escaped to allow inclusion of whitespace and other control characters. 1268 1269 This key can be listed multiple times. 1270 1271 ### `Group=` 1272 1273 The host (numeric) GID, or group name to use as the group for the volume 1274 1275 ### `Image=` 1276 1277 Specifies the image the volume is based on when `Driver` is set to the `image`. 1278 It is recommended to use a fully qualified image name rather than a short name, both for 1279 performance and robustness reasons. 1280 1281 The format of the name is the same as when passed to `podman pull`. So, it supports using 1282 `:tag` or digests to guarantee the specific image version. 1283 1284 As a special case, if the `name` of the image ends with `.image`, Quadlet will use the image 1285 pulled by the corresponding `.image` file, and the generated systemd service contains 1286 a dependency on the `$name-image.service`. 1287 Note that the corresponding `.image` file must exist. 1288 1289 ### `Label=` 1290 1291 Set one or more OCI labels on the volume. The format is a list of 1292 `key=value` items, similar to `Environment`. 1293 1294 This key can be listed multiple times. 1295 1296 ### `Options=` 1297 1298 The mount options to use for a filesystem as used by the **mount(8)** command `-o` option. 1299 1300 ### `PodmanArgs=` 1301 1302 This key contains a list of arguments passed directly to the end of the `podman volume create` command 1303 in the generated file (right before the name of the volume in the command line). It can be used to 1304 access Podman features otherwise unsupported by the generator. Since the generator is unaware 1305 of what unexpected interactions can be caused by these arguments, is not recommended to use 1306 this option. 1307 1308 The format of this is a space separated list of arguments, which can optionally be individually 1309 escaped to allow inclusion of whitespace and other control characters. 1310 1311 This key can be listed multiple times. 1312 1313 ### `Type=` 1314 1315 The filesystem type of `Device` as used by the **mount(8)** commands `-t` option. 1316 1317 ### `User=` 1318 1319 The host (numeric) UID, or user name to use as the owner for the volume 1320 1321 ### `VolumeName=` 1322 1323 The (optional) name of the Podman volume. If this is not specified, the default value of 1324 `systemd-%N` is used, which is the same as the unit name but with a `systemd-` prefix to avoid 1325 conflicts with user-managed volumes. 1326 1327 ## Image units [Image] 1328 1329 Image files are named with a `.image` extension and contain a section `[Image]` describing the 1330 container image pull command. The generated service is a one-time command that ensures that the image 1331 exists on the host, pulling it if needed. 1332 1333 Using image units allows containers and volumes to depend on images being automatically pulled. This is 1334 particularly interesting when using special options to control image pulls. 1335 1336 Valid options for `[Image]` are listed below: 1337 1338 | **[Image] options** | **podman image pull equivalent** | 1339 |----------------------------------------|--------------------------------------------------| 1340 | AllTags=true | --all-tags | 1341 | Arch=aarch64 | --arch=aarch64 | 1342 | AuthFile=/etc/registry/auth\.json | --authfile=/etc/registry/auth\.json | 1343 | CertDir=/etc/registry/certs | --cert-dir=/etc/registry/certs | 1344 | ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf | 1345 | Creds=myname\:mypassword | --creds=myname\:mypassword | 1346 | DecryptionKey=/etc/registry\.key | --decryption-key=/etc/registry\.key | 1347 | GlobalArgs=--log-level=debug | --log-level=debug | 1348 | Image=quay\.io/centos/centos:latest | podman image pull quay.io/centos/centos\:latest | 1349 | ImageTag=quay\.io/centos/centos:latest | Use this name when resolving `.image` references | 1350 | OS=windows | --os=windows | 1351 | PodmanArgs=--os=linux | --os=linux | 1352 | TLSVerify=false | --tls-verify=false | 1353 | Variant=arm/v7 | --variant=arm/v7 | 1354 1355 ### `AllTags=` 1356 1357 All tagged images in the repository are pulled. 1358 1359 This is equivalent to the Podman `--all-tags` option. 1360 1361 ### `Arch=` 1362 1363 Override the architecture, defaults to hosts, of the image to be pulled. 1364 1365 This is equivalent to the Podman `--arch` option. 1366 1367 ### `AuthFile=` 1368 1369 Path of the authentication file. 1370 1371 This is equivalent to the Podman `--authfile` option. 1372 1373 ### `CertDir=` 1374 1375 Use certificates at path (*.crt, *.cert, *.key) to connect to the registry. 1376 1377 This is equivalent to the Podman `--cert-dir` option. 1378 1379 ### `ContainersConfModule=` 1380 1381 Load the specified containers.conf(5) module. Equivalent to the Podman `--module` option. 1382 1383 This key can be listed multiple times. 1384 1385 ### `Creds=` 1386 1387 The `[username[:password]]` to use to authenticate with the registry, if required. 1388 1389 This is equivalent to the Podman `--creds` option. 1390 1391 ### `DecryptionKey=` 1392 1393 The `[key[:passphrase]]` to be used for decryption of images. 1394 1395 This is equivalent to the Podman `--decryption-key` option. 1396 1397 ### `GlobalArgs=` 1398 1399 This key contains a list of arguments passed directly between `podman` and `image` 1400 in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware 1401 of what unexpected interactions can be caused by these arguments, it is not recommended to use 1402 this option. 1403 1404 The format of this is a space separated list of arguments, which can optionally be individually 1405 escaped to allow inclusion of whitespace and other control characters. 1406 1407 This key can be listed multiple times. 1408 1409 ### `Image=` 1410 1411 The image to pull. 1412 It is recommended to use a fully qualified image name rather than a short name, both for 1413 performance and robustness reasons. 1414 1415 The format of the name is the same as when passed to `podman pull`. So, it supports using 1416 `:tag` or digests to guarantee the specific image version. 1417 1418 ### `ImageTag=` 1419 1420 Actual FQIN of the referenced `Image`. 1421 Only meaningful when source is a file or directory archive. 1422 1423 For example, an image saved into a `docker-archive` with the following Podman command: 1424 1425 `podman image save --format docker-archive --output /tmp/archive-file.tar quay.io/podman/stable:latest` 1426 1427 requires setting 1428 - `Image=docker-archive:/tmp/archive-file.tar` 1429 - `ImageTag=quay.io/podman/stable:latest` 1430 1431 ### `OS=` 1432 1433 Override the OS, defaults to hosts, of the image to be pulled. 1434 1435 This is equivalent to the Podman `--os` option. 1436 1437 ### `PodmanArgs=` 1438 1439 This key contains a list of arguments passed directly to the end of the `podman image pull` command 1440 in the generated file (right before the image name in the command line). It can be used to 1441 access Podman features otherwise unsupported by the generator. Since the generator is unaware 1442 of what unexpected interactions can be caused by these arguments, it is not recommended to use 1443 this option. 1444 1445 The format of this is a space separated list of arguments, which can optionally be individually 1446 escaped to allow inclusion of whitespace and other control characters. 1447 1448 This key can be listed multiple times. 1449 1450 ### `TLSVerify=` 1451 1452 Require HTTPS and verification of certificates when contacting registries. 1453 1454 This is equivalent to the Podman `--tls-verify` option. 1455 1456 ### `Variant=` 1457 1458 Override the default architecture variant of the container image. 1459 1460 This is equivalent to the Podman `--variant` option. 1461 1462 ## EXAMPLES 1463 1464 Example `test.container`: 1465 1466 ``` 1467 [Unit] 1468 Description=A minimal container 1469 1470 [Container] 1471 # Use the centos image 1472 Image=quay.io/centos/centos:latest 1473 1474 # Use volume and network defined below 1475 Volume=test.volume:/data 1476 Network=test.network 1477 1478 # In the container we just run sleep 1479 Exec=sleep 60 1480 1481 [Service] 1482 # Restart service when sleep finishes 1483 Restart=always 1484 # Extend Timeout to allow time to pull the image 1485 TimeoutStartSec=900 1486 # ExecStartPre flag and other systemd commands can go here, see systemd.unit(5) man page. 1487 ExecStartPre=/usr/share/mincontainer/setup.sh 1488 1489 [Install] 1490 # Start by default on boot 1491 WantedBy=multi-user.target default.target 1492 ``` 1493 1494 Example `test.kube`: 1495 ``` 1496 [Unit] 1497 Description=A kubernetes yaml based service 1498 Before=local-fs.target 1499 1500 [Kube] 1501 Yaml=/opt/k8s/deployment.yml 1502 1503 [Install] 1504 # Start by default on boot 1505 WantedBy=multi-user.target default.target 1506 ``` 1507 1508 Example `test.volume`: 1509 1510 ``` 1511 [Volume] 1512 User=root 1513 Group=root 1514 Label=org.test.Key=value 1515 ``` 1516 1517 Example `test.network`: 1518 ``` 1519 [Network] 1520 Subnet=172.16.0.0/24 1521 Gateway=172.16.0.1 1522 IPRange=172.16.0.0/28 1523 Label=org.test.Key=value 1524 ``` 1525 1526 Example for Container in a Pod: 1527 1528 `test.pod` 1529 ``` 1530 [Pod] 1531 PodName=test 1532 ``` 1533 1534 `centos.container` 1535 ``` 1536 [Container] 1537 Image=quay.io/centos/centos:latest 1538 Exec=sh -c "sleep inf" 1539 Pod=test.pod 1540 ``` 1541 1542 Example `s3fs.volume`: 1543 1544 For further details, please see the [s3fs-fuse](https://github.com/s3fs-fuse/s3fs-fuse) project. 1545 Remember to read the [FAQ](https://github.com/s3fs-fuse/s3fs-fuse/wiki/FAQ) 1546 1547 > NOTE: Enabling the cache massively speeds up access and write times on static files/objects. 1548 1549 > However, `use_cache` is [UNBOUNDED](https://github.com/s3fs-fuse/s3fs-fuse/wiki/FAQ#q-how-does-the-local-file-cache-work)! 1550 1551 > Be careful, it will fill up with any files accessed on the s3 bucket through the file system. 1552 1553 Please remember to set `S3_BUCKET`, `PATH`, `AWS_REGION`. `CACHE_DIRECTORY` should be set up by [systemd](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#RuntimeDirectory=) 1554 1555 ``` 1556 [Service] 1557 CacheDirectory=s3fs 1558 ExecStartPre=/usr/local/bin/aws s3api put-object --bucket ${S3_BUCKET} --key ${PATH}/ 1559 1560 [Volume] 1561 Device=${S3_BUCKET}:/${PATH} 1562 Type=fuse.s3fs 1563 VolumeName=s3fs-volume 1564 Options=iam_role,endpoint=${AWS_REGION},use_xattr,listobjectsv2,del_cache,use_cache=${CACHE_DIRECTORY} 1565 # `iam_role` assumes inside EC2, if not, Use `profile=` instead 1566 ``` 1567 1568 ## SEE ALSO 1569 **[systemd.unit(5)](https://www.freedesktop.org/software/systemd/man/systemd.unit.html)**, 1570 **[systemd.service(5)](https://www.freedesktop.org/software/systemd/man/systemd.service.html)**, 1571 **[podman-run(1)](podman-run.1.md)**, 1572 **[podman-network-create(1)](podman-network-create.1.md)**, 1573 **[podman-auto-update(1)](podman-auto-update.1.md)** 1574 **[systemd.unit(5)]**