podman-pod.unit(5)
π podman-pod.unit(5) π
okay bestie, we're in the File Formats Manual and this is the Podman pod unit file page β yes, the Quadlet one. Buckle up. π¦
πΈ NAME πΈ
podman-pod.unit β systemd unit files for managing Podman pods using Quadlet. That's the whole name, no cap, periodt. π
β¨ SYNOPSIS β¨
name.pod
A .pod name. Short and iconic. π
π DESCRIPTION π
Pod units are named with a .pod extension and contain a [Pod] section describing the pod that is created and run as a service. The resulting service file contains a line like ExecStartPre=podman pod create β¦, and most of the keys in this section control the command-line options passed to Podman. π«Ά
By default, the Podman pod has the same name as the unit, but with a systemd- prefix, i.e. a $name.pod file creates a $name-pod.service unit and a systemd-$name Podman pod. The PodName option allows for overriding this default name with a user-provided one. β¨
π OPTIONS π
Valid options for [Pod] are listed below:
Here's the mapping cheat sheet β left side is the [Pod] option, right side is the podman pod create equivalent. π«Ά
AddHost=example.com:192.168.10.11β--add-host example.com:192.168.10.11ContainersConfModule=/etc/nvd.confβ--module=/etc/nvd.confDNS=192.168.55.1β--dns=192.168.55.1DNSOption=ndots:1β--dns-option=ndots:1DNSSearch=example.comβ--dns-search example.comExitPolicy=stopβ--exit-policy stopGIDMap=0:10000:10β--gidmap=0:10000:10GlobalArgs=--log-level=debugβ--log-level=debugHostName=nameβ--hostname=nameIP=192.5.0.1β--ip 192.5.0.1IP6=2001:db8::1β--ip6 2001:db8::1Label="XYZ"β--label "XYZ"Network=hostβ--network hostNetworkAlias=nameβ--network-alias namePodmanArgs=--cpus=2β--cpus=2PodName=nameβ--name=namePublishPort=8080:80β--publish 8080:80ServiceName=nameβ Name the systemd unitname.serviceShmSize=100mβ--shm-size=100mSubGIDMap=gtestβ--subgidname=gtestSubUIDMap=utestβ--subuidname=utestUIDMap=0:10000:10β--uidmap=0:10000:10UserNS=keep-id:uid=200,gid=210β--userns keep-id:uid=200,gid=210Volume=/source:/destβ--volume /source:/dest
Supported keys in the [Pod] section are:
π·οΈ AddHost=hostname[;hostname[;...]]:ip
Add a custom host-to-IP mapping to the container's /etc/hosts file. π
The option takes one or multiple semicolon-separated hostnames to be mapped to a single IPv4 or IPv6 address, separated by a colon. It can also be used to overwrite the IP addresses of hostnames Podman adds to /etc/hosts by default (also see the --name and --hostname options). This option can be specified multiple times to add additional mappings to /etc/hosts. It conflicts with the --no-hosts option and conflicts with no_hosts=true in containers.conf. π
Instead of an IP address, the special flag host-gateway can be given. This resolves to an IP address the container can use to connect to the host. The IP address chosen depends on your network setup, thus there's no guarantee that Podman can determine the host-gateway address automatically, which will then cause Podman to fail with an error message. You can overwrite this IP address using the host_containers_internal_ip option in containers.conf. π₯
bestie, heads up: if the host-gateway address can't be figured out automatically, that's a Podman error situation β not a vibe. π
The host-gateway address is also used by Podman to automatically add the host.containers.internal and host.docker.internal hostnames to /etc/hosts. You can prevent that by either giving the --no-hosts option, or by setting host_containers_internal_ip="none" in containers.conf. If no host-gateway address was configured manually and Podman fails to determine the IP address automatically, Podman will silently skip adding these internal hostnames to /etc/hosts. If Podman is running in a virtual machine using podman machine (this includes Mac and Windows hosts), Podman will silently skip adding the internal hostnames to /etc/hosts, unless an IP address was configured manually; the internal hostnames are resolved by the gvproxy DNS resolver instead. π§
Podman will use the /etc/hosts file of the host as a basis by default, i.e. any hostname present in this file will also be present in the /etc/hosts file of the container. A different base file can be configured using the base_hosts_file config in containers.conf. π
π ContainersConfModule=module
Load the specified containers.conf(5) module. β¨
This option can be listed multiple times. π«Ά
π¦ DNS=ipaddr
Set custom DNS servers. π
So like, this option is your DNS override button π β it overrides the DNS configuration that gets passed to the container. Usually you only need it when the host's DNS config is straight-up invalid for the container (think 127.0.0.1, yeah that one π). When that's the case, the DNS=. flag is necessary for every run.
The special value none can be specified to disable creation of /etc/resolv.conf in the container by Podman β¨ β then the /etc/resolv.conf file from the image is used without changes, no edits, no notes.
Also heads up: ipaddr may be added directly to the container's /etc/resolv.conf, but it's not guaranteed π. Like, for example, passing a custom network whose dns_enabled is set to true to --network will result in /etc/resolv.conf only referring to the aardvark-dns server. Then aardvark-dns forwards to the supplied ipaddr for all non-container name queries. iykyk π¦
DNSOption=option
Set custom DNS options. Invalid if you use DNSOption= with Network= that's set to none or container:id. π
DNSSearch=domain
Set custom DNS search domains. Invalid if you use DNSSearch= with Network= that's set to none or container:id. Use DNSSearch=. to remove the search domain. π§
ExitPolicy=stop
Set the exit policy of the pod when the last container exits. Default for quadlets is stop. π
If you wanna keep the pod active, set ExitPolicy=continue.
GIDMap=[flags]container_gid:from_gid[:amount]
Run the container in a new user namespace using the supplied GID mapping. This option conflicts with the UserNS= and SubGIDMap= options, so pick a lane bestie π€. This option provides a way to map host GIDs to container GIDs in the same way as --uidmap maps host UIDs to container UIDs. For details see --uidmap.
Note: theGIDMap=option cannot be called in conjunction with thePod=option as a gidmap cannot be set on the container level when in a pod. π«Ά
GlobalArgs=
This key contains a list of arguments passed directly after the podman command in the generated file. It can be used to access Podman features otherwise unsupported by the generator. Since the generator is unaware of what unexpected interactions can be caused by these arguments, it is not recommended to use this option β like, it's giving "you can, but should you" energy π.
The format of this is a space separated list of arguments, which can optionally be individually escaped to allow inclusion of whitespace and other control characters.
This key can be listed multiple times. β¨
HostName=name
Set the container's hostname inside the container. πΈ
This option can only be used with a private UTS namespace β --uts=private (default). If Pod= is given and the pod shares the same UTS namespace (default), the pod's hostname is used. The given hostname is also added to the /etc/hosts file using the container's primary IP address (also see the AddHost= option).
When HostName= is unset and the container uses a private UTS namespace (default), Podman sets the hostname to the first 12 characters of the container ID. The container name assigned with ContainerName= is not used unless container_name_as_hostname=true is set in containers.conf. π
Podman network DNS registers the container name, the short container ID (first 12 characters), and any explicitly set --hostname as DNS names. The default hostname matches the short ID alias. See podman-network(1). π
IP=IPv4
Specify a static IPv4 address for the container, for example 10.88.64.128. This option can only be used if the container is joined to only a single network β i.e., Network=network-name is used at most once β and if the container is not joining another container's network namespace via Network=container:id. The address must be within the network's IP address pool (default 10.88.0.0/16). π
To specify multiple static IP addresses per container, set multiple networks using the Network= option with a static IP address specified for each using the ip mode for that option.
IP6=IPv6
Specify a static IPv6 address for the container, for example fd46:db93:aa76:ac37::10. This option can only be used if the container is joined to only a single network β i.e., Network=network-name is used at most once β and if the container is not joining another container's network namespace via Network=container:id. The address must be within the network's IPv6 address pool. π¦
To specify multiple static IPv6 addresses per container, set multiple networks using the Network= option with a static IPv6 address specified for each using the ip6 mode for that option.
Label=key=value [key=value ...]
Add metadata to a container. π·οΈ
Network=mode
Set the network mode for the container. This one's the main character fr π
Special cases:
- If the name of the network ends with
.network, a Podman network calledsystemd-$nameis used, and the generated systemd service contains a dependency on the$name-network.service. Such a network can be automatically created by using a$name.networkQuadlet file. Note: the corresponding.networkfile must exist. - If the name ends with
.container, the container will reuse the network stack of another container created by$name.container. The generated systemd service contains a dependency on$name.service. Note: the corresponding.containerfile must exist.
Valid mode values are: β¨
bridge[:OPTIONS,...]: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options:alias=name: Add network-scoped alias for the container.ip=IPv4: Specify a static IPv4 address for this container.ip6=IPv6: Specify a static IPv6 address for this container.mac=MAC: Specify a static MAC address for this container.interface_name=name: Specify a name for the created network interface inside the container.host_interface_name=name: Specify a name for the created network interface outside the container.
Any other options will be passed through to netavark without validation. This can be useful to pass arguments to netavark plugins.
For rootless bridge networks, port forwarding uses rootlessport by default. Setting rootless_port_forwarder="pasta" in the [network] section of containers.conf(5) switches to pasta's kernel-level forwarding (via pesto), which preserves the original client source IP address inside the container. This option is experimental and its behavior is subject to change β οΈ.
For example, to set a static IPv4 address and a static mac address, use --network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99.
<network name or ID>[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created bypodman network create. It is possible to specify the same options described under thebridgemode above. Use the--networkoption multiple times to specify additional networks. For backwards compatibility it is also possible to specify comma-separated networks on the first--networkargument, however this prevents you from using the options described under thebridgesection above. πnone: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity.container:id: Reuse another container's network stack.host: Use the host's network namespace for the container instead of creating an isolated namespace. Warning: This gives the container full access to abstract Unix domain sockets and to TCP/UDP sockets bound to localhost. Since these mechanisms are often used to prevent access to sensitive system services, isolating them from access by external entities, use of this option may be considered a security vulnerability. π¨ns:path: Path to a network namespace to join.private: Create a new namespace for the container. This uses thebridgemode for rootful containers andpastafor rootless ones.pasta[:OPTIONS,...]: usepasta(1)to create a user-mode networking stack. This is the default for rootless containers and only supported in rootless mode. By default, IPv4 and IPv6 addresses and routes, as well as the pod interface name, are copied from the host. Port forwarding preserves the original source IP address. Options described inpasta(1)can be specified as comma-separated arguments. In terms ofpasta(1)options,--config-netis given by default, in order to configure networking when the container is started, and--no-map-gwis also assumed by default, to avoid direct access from container to host using the gateway address. The latter can be overridden by passing--map-gwin the pasta-specific options (despite not being an actualpasta(1)option). For better integration with DNS handling,--dns-forward 169.254.1.1is passed by default, and this address is added toresolv.conf(5)as first resolver. It is possible to pass--dns-forwardexplicitly in case a different IP address should be used. To make thehost.containers.internal/etc/hostsentry work and allow connections to the host,--map-guest-addr 169.254.1.2is passed by default. Again, it can be set explicitly to choose a different IP address. Also,-t noneand-u noneare passed if, respectively, no TCP or UDP port forwarding from host to container is configured (via Podman's--publishor by passing the pasta-t/-uoptions directly), to disable automatic port forwarding based on bound ports. Similarly,-T noneand-U noneare given to disable the same functionality from container to host. All options can also be set incontainers.conf(5); see thepasta_optionskey under thenetworksection in that file. π«Ά
Some examples:
pasta:--map-gw: Allow the container to directly reach the host using the gateway address.pasta:--mtu,1500: Specify a 1500 bytes MTU for the tap interface in the container.pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp: disable IPv6, assign10.0.2.0/24to thetap0interface in the container, with gateway10.0.2.3, enable DNS forwarder reachable at10.0.2.3, set MTU to 1500 bytes, disable NDP, DHCPv6 and DHCP support.pasta:-I,tap0,--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,--no-ndp,--no-dhcpv6,--no-dhcp: same as above, but leave the MTU to 65520 bytespasta:-t,auto,-u,auto,-T,auto,-U,auto: enable automatic port forwarding based on observed bound ports from both host and container sidespasta:-T,5201: enable forwarding of TCP port 5201 from container to host, using the loopback interface instead of the tap interface for improved performance π₯
NetworkAlias=aliasβ adds a network-scoped alias for the container, and that alias gets set for all the networks the container joins, bestie. If you only want a name on one specific network, use the alias option described under the--networkoption instead. If the network has DNS enabled (podman network inspect -f {{.DNSEnabled}} <name>), these aliases can be used for name resolution on that network. This option can be specified multiple times. π«ΆPodmanArgs=β this key holds a list of arguments passed directly to the end of thepodmancommand in the generated file. Itβs the little backstage pass for Podman features the generator doesnβt support otherwise. But fair warning: since the generator is unaware of what unexpected interactions these arguments can cause, itβs not recommended to use this option. The format is a space-separated list of arguments, which can optionally be individually escaped to allow inclusion of whitespace and other control characters. This key can be listed multiple times. β¨PodName=nameβ the (optional) name of the Podman pod. If you donβt specify it, the default is the same name as the unit, but with asystemd-prefix. So a$name.podfile creates asystemd-$namePodman pod, and thatβs literally to avoid conflicts with user-managed pods. Please note: pods and containers cannot have the same name. So ifPodNameis set, it must not conflict with any container. πPublishPort=[[hostIP:][hostPort]:]containerPort[/protocol]β publishes a containerβs port, or range of ports, to the host. BothhostPortandcontainerPortcan be specified as a range of ports. When you specify ranges for both, the number of container ports in the range must match the number of host ports in the range. πΈ
If hostIP is 0.0.0.0, only IPv4 addresses will be bound; if set to [::], only IPv6 addresses are bound. In all other cases the exact IP address as given will be bound. If hostIP is not set at all, the port is bound on all IP addresses on the host, both v4 and v6 (if possible). π
The default hostIP can be configured in containers.conf(5) using the default_host_ips option under the [network] section. This option accepts an array to be able to set multiple bind IP addresses. For example, setting default_host_ips = ["127.0.0.1", "::1"] will make the port be published on the ipv4 and ipv6 localhost address respectively. An explicit hostIP set on the command will always override the config option. π
By default, Podman publishes TCP ports. To publish a UDP port instead, give udp as protocol. To publish both TCP and UDP ports, set --publish twice, with tcp and udp as protocols respectively. Rootful containers can also publish ports using the sctp protocol. π₯
Host port does not have to be specified (e.g. podman run -p 127.0.0.1::80). If it is not, the container port is randomly assigned a port on the host. Use podman port to see the actual mapping: podman port $CONTAINER $CONTAINERPORT. β
Port publishing is only supported for containers utilizing their own network namespace through bridge networks, or the pasta network mode. For rootless bridge networks, port forwarding uses rootlessport by default, which is a userspace proxy that does not preserve client source IPs. Setting rootless_port_forwarder="pasta" in the [network] section of containers.conf(5) switches to pastaβs kernel-level forwarding via pesto, preserving the original client IP address inside the container. > This option is experimental and its behavior is subject to change. π
ServiceName=nameβ by default, Quadlet will name the systemd service unit by appending-podto the name of the Quadlet. Setting this key overrides that behavior by instructing Quadlet to use the provided name. Note that the name should not include the.servicefile extension. π¦ShmSize=number[unit]β size of/dev/shm. A unit can beb(bytes),k(kibibytes),m(mebibytes), org(gibibytes). If the unit is omitted, the system uses bytes. If the size is omitted, the default is64m. When size is0, there is no limit on the amount of memory used for IPC by the container. This option conflicts with--ipc=host. πSubGIDMap=nameβ run the container in a new user namespace using the map withnamein the/etc/subgidfile. When running rootless, the user needs the necessary permissions to use the mapping. Seesubgid(5). This flag conflicts withUserNS=andGIDMap=. Together withGIDMap=it acts as ifGIDMap=was passed with all mappings of thenamegroup in/etc/subgid. πSubUIDMap=nameβ run the container in a new user namespace using the map withnamein the/etc/subuidfile. When running rootless, the user needs the necessary permissions to use the mapping. Seesubuid(5). This flag conflicts withUserNS=andUIDMap=. Together withUIDMap=it acts as ifUIDMap=was passed with all mappings of thenameuser in/etc/subuid. π§UIDMap=container_uid:from_uid[:amount]β run all containers in the pod in a new user namespace using the supplied mapping. This option conflicts with theUserNS=andSubUIDMap=options. It gives you a way to map host UIDs to container UIDs. It can be passed several times to map different ranges. πUserNS=modeβ set the user namespace mode for all the containers in a pod. It defaults to thePODMAN_USERNSenvironment variable. An empty value ("") means user namespaces are disabled. π
Rootless user UserNS= key mappings:
""β Host User:$UID; Container User:0(Default User account mapped to root user in container.)hostβ Host User:$UID; Container User:0(Default User account mapped to root user in container.)keep-idβ Host User:$UID; Container User:$UID(Map user account to same UID within container.)autoβ Host User:$UID; Container User:nil(Host User UID is not mapped into container.)nomapβ Host User:$UID; Container User:nil(Host User UID is not mapped into container.)
Valid mode values are:
auto[:OPTIONS,...]: automatically create a namespace. It is possible to specify these options toauto:gidmapping=CONTAINER_GID:HOST_GID:SIZEto force a GID mapping to be present in the user namespace.size=SIZE: to specify an explicit size for the automatic user namespace. e.g.UserNS=auto:size=8192. Ifsizeis not specified,autoestimates the size for the user namespace.uidmapping=CONTAINER_UID:HOST_UID:SIZEto force a UID mapping to be present in the user namespace.
host: run in the user namespace of the caller. The processes running in the container have the same privileges on the host as any other process launched by the calling user (default).keep-id: creates a user namespace where the current rootless userβsUID:GIDare mapped to the same values in the container. This option is not allowed for containers created by the root user.nomap: creates a user namespace where the current rootless userβsUID:GIDare not mapped into the container. This option is not allowed for containers created by the root user.
Volume=[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]β create a bind mount, bestie. If-v /HOST-DIR:/CONTAINER-DIRis specified, Podman bind mounts/HOST-DIRfrom the host into/CONTAINER-DIRin the Podman container. Similarly,-v SOURCE-VOLUME:/CONTAINER-DIRmounts the named volume from the host into the container. If no such named volume exists, Podman creates one. Thenocreateoption can be used to disable this behavior and require the volume to already exist. If no source is given, the volume is created as an anonymously named volume with a randomly generated name, and is removed when the container is removed via the--rmflag or thepodman rm --volumescommand. πΈ
Special case:
- If
SOURCE-VOLUMEends with.volume, a Podman named volume calledsystemd-$nameis used as the source, and the generated systemd service contains a dependency on the$name-volume.service. Note that the corresponding.volumefile must exist. β¨
(Note when using the remote client, including Mac and Windows (excluding WSL2) machines, the volumes are mounted from the remote server, not necessarily the client machine.)
The OPTIONS is a comma-separated list and can be one or more of:
rw|roz|Z[O][U][no]copy[no]dev[no]exec[no]suid[r]bind[r]shared|[r]slave|[r]private[r]unbindable[1] β¨#Footnote1β©idmap[=options]nocreate
The CONTAINER-DIR must be an absolute path such as /src/docs. The volume is mounted into the container at this directory. π«Ά
If a volume source is specified, it must be a path on the host or the name of a named volume. Host paths are allowed to be absolute or relative; relative paths are resolved relative to the directory Podman is run in. If the source does not exist, Podman returns an error. Users must pre-create the source files or directories. π
Any source that does not begin with a . or / is treated as the name of a named volume. If a volume with that name does not exist, it is created. Volumes created with names are not anonymous, and they are not removed by the --rm option and the podman rm --volumes command. π
The nocreate option can be specified for named volumes to prevent automatic volume creation. If nocreate is set and the volume does not exist, Podman returns an error instead of creating the volume. This is useful when you want to ensure that a volume was explicitly created before use. π
okay so like, volume-mounting era, letβs go β hereβs the exact little example:
$ podman podman-pod.unit.5.md.in -v myvolume:/data:nocreate alpine
And yes bestie: you can specify multiple -v options to mount one or more volumes into a container. Thatβs the vibe. π«Ά
π Write Protected Volume Mounts π
Add :ro or :rw option to mount a volume in read-only or read-write mode, respectively. By default, the volumes are mounted read-write. See examples.
π Chowning Volume Mounts π
When a named volume is first mounted to a container, Podman automatically adjusts the ownership of the volumeβs mount point during container initialization. This chown operation occurs under these conditions:
- The volume was not used yet (has
NeedsChownset totrue) - The volume is empty or has not been copied up yet
- The volume is not managed by an external volume driver
- The volume driver is not
"image"
For volumes with idmapped mounts (using the idmap option), the ownership change takes into account the containerβs user namespace mappings, but the idmapped volume retains proper UID/GID mapping. For volumes without idmapping, the mount point is chowned to match the containerβs process user and group, mapped to the host user namespace if user namespace remapping is enabled.
If a container is created in a new user namespace, the UID and GID in the container may correspond to another UID and GID on the host.
The :U suffix tells Podman to use the correct host UID and GID based on the UID and GID within the container, to change recursively the owner and group of the source volume. Chowning walks the file system under the volume and changes the UID/GID on each file. If the volume has thousands of inodes, this process takes a long time, delaying the start of the container.
β οΈ Warning: use with caution since this modifies the host filesystem.
πΈ Labeling Volume Mounts πΈ
Labeling systems like SELinux require that proper labels are placed on volume content mounted into a container. Without a label, the security system might prevent the processes running inside the container from using the content. By default, Podman does not change the labels set by the OS.
To change a label in the container context, add either of two suffixes :z or :Z to the volume mount. These suffixes tell Podman to relabel file objects on the shared volumes. The z option tells Podman that two or more containers share the volume content. As a result, Podman labels the content with a shared content label. Shared volume labels allow all containers to read/write content. The Z option tells Podman to label the content with a private unshared label. Only the current container can use a private volume.
Note: all containers within a pod share the same SELinux label. This means all containers within said pod can read/write volumes shared into the container created with the:Zon any one of the containers. Relabeling walks the file system under the volume and changes the label on each file; if the volume has thousands of inodes, this process takes a long time, delaying the start of the container. If the volume was previously relabeled with thezoption, Podman is optimized to not relabel a second time. If files are moved into the volume, then the labels can be manually changed with thechcon -Rt container_file_t PATHcommand.
Note: Do not relabel system files and directories. Relabeling system content might cause other confined services on the machine to fail. For these types of containers we recommend disabling SELinux separation. The option --security-opt label=disable disables SELinux separation for the container. For example if a user wanted to volume mount their entire home directory into a container, they need to disable SELinux separation.
$ podman podman-pod.unit.5.md.in --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file
π¦ Overlay Volume Mounts π¦
The :O flag tells Podman to mount the directory from the host as a temporary storage using the overlay file system. The container processes can modify content within the mountpoint which is stored in the container storage in a separate directory. In overlay terms, the source directory is the lower, and the container storage directory is the upper. Modifications to the mount point are destroyed when the container finishes executing, similar to a tmpfs mount point being unmounted.
For advanced users, the overlay option also supports custom non-volatile upperdir and workdir for the overlay mount. Custom upperdir and workdir can be fully managed by the users themselves, and Podman does not remove it on lifecycle completion. Example :O,upperdir=/some/upper,workdir=/some/work
Subsequent executions of the container sees the original source directory content, any changes from previous container executions no longer exist.
One use case of the overlay mount is sharing the package cache from the host into the container to allow speeding up builds.
Note: The O flag conflicts with other options listed above.
Content mounted into the container is labeled with the private label. On SELinux systems, labels in the source directory must be readable by the container label. Usually containers can read/execute container_share_t and can read/write container_file_t. If unable to change the labels on a source volume, SELinux container separation must be disabled for the container to work.
Do not modify the source directory mounted into the container with an overlay mount, it can cause unexpected failures. Only modify the directory after the container finishes running.
π Mounts propagation π
By default, bind-mounted volumes are private. That means any mounts done inside the container are not visible on the host and vice versa. One can change this behavior by specifying a volume mount propagation property. When a volume is shared, mounts done under that volume inside the container are visible on host and vice versa. Making a volume slave[1] β¨#Footnote1β© enables only one-way mount propagation: mounts done on the host under that volume are visible inside the container but not the other way around.
To control mount propagation property of a volume one can use the [r]shared, [r]slave, [r]private or the [r]unbindable propagation flag. Propagation property can be specified only for bind mounted volumes and not for internal volumes or named volumes. For mount propagation to work the source mount point (the mount point where source dir is mounted on) has to have the right propagation properties. For shared volumes, the source mount point has to be shared. And for slave volumes, the source mount point has to be either shared or slave. [1] β¨#Footnote1β©
To recursively mount a volume and all of its submounts into a container, use the rbind option. By default the bind option is used, and submounts of the source directory is not mounted into the container.
Mounting the volume with a copy option tells podman to copy content from the underlying destination directory onto newly created internal volumes. The copy only happens on the initial creation of the volume. Content is not copied up when the volume is subsequently used on different containers. The copy option is ignored on bind mounts and has no effect.
Mounting volumes with the nosuid options means that SUID executables on the volume can not be used by applications to change their privilege. By default volumes are mounted with nosuid.
Mounting the volume with the noexec option means that no executables on the volume can be executed within the container.
Mounting the volume with the nodev option means that no devices on the volume can be used by processes within the container. By default volumes are mounted with nodev.
If the HOST-DIR is a mount point, then dev, suid, and exec options are ignored by the kernel.
Use df HOST-DIR to figure out the source mount, then use findmnt -o TARGET,PROPAGATION source-mount-dir to figure out propagation properties of source mount. If findmnt(1) utility is not available, then one can look at the mount entry for the source mount point in /proc/self/mountinfo. Look at the "optional fields" and see if any propagation properties are specified. In there, shared:N means the mount is shared, master:N means mount is slave, and if nothing is there, the mount is private. [1] β¨#Footnote1β©
To change propagation properties of a mount point, use mount(8) command. For example, if one wants to bind mount source directory /foo, one can do mount --bind /foo /foo and mount --make-private --make-shared /foo. This converts /foo into a shared mount point. Alternatively, one can directly change propagation properties of source mount. Say / is source mount for /foo, then use mount --make-shared / to convert / into a shared mount.
Note: if the user only has access rights via a group, accessing the volume from inside a rootless container fails.
π Idmapped mount π
If idmap is specified, create an idmapped mount to the target user namespace in the container. The idmap option supports a custom mapping that can be different than the user namespace used by the container. The mapping can be specified after the idmap option like: idmap=uids=0-1-10#10-11-10;gids=0-100-10. For each triplet, the first value is the start of the backing file system IDs that are mapped to the second value on the host. The length of this mapping is given in the third value. Multiple ranges are separated with #.
β¨ EXAMPLES β¨
π Example: container in a pod π
test.pod:
[Pod]
PodName=test
centos.container:
[Container]
Image=quay.io/centos/centos:latest
Exec=sh -c "sleep inf"
Pod=test.pod
π SEE ALSO π
and thatβs the whole podman-pod.unit(5) page, bestie β source/version + date footer are lowkey royalty, mwah π
π
π¦ where this page comes from
- arch rolling: podman 6.1.4-1 Β· Apache-2.0
- nixpkgs unstable: podman 6.1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms