.nh .TH podman-run 1 .SH NAME .PP podman-run - Run a command in a new container .SH SYNOPSIS .PP \fBpodman run\fP [\fIoptions\fP] \fIimage\fP [\fIcommand\fP [\fIarg\fP ...]] .PP \fBpodman container run\fP [\fIoptions\fP] \fIimage\fP [\fIcommand\fP [\fIarg\fP ...]] .SH DESCRIPTION .PP Run a process in a new container. \fBpodman run\fP starts a process with its own file system, its own networking, and its own isolated process tree. The \fIimage\fP which starts the process may define defaults related to the process that will be run in the container, the networking to expose, and more, but \fBpodman run\fP gives final control to the operator or administrator who starts the container from the image. For that reason \fBpodman run\fP has more options than any other Podman command. .PP If the \fIimage\fP is not already loaded then \fBpodman run\fP will pull the \fIimage\fP, and all image dependencies, from the repository in the same way running \fBpodman pull\fP \fIimage\fP , before it starts the container from that image. .PP Several files will be automatically created within the container. These include \fI/etc/hosts\fP, \fI/etc/hostname\fP, and \fI/etc/resolv.conf\fP to manage networking. These will be based on the host's version of the files, though they can be customized with options (for example, \fB--dns\fP will override the host's DNS servers in the created \fIresolv.conf\fP). Additionally, a container environment file is created in each container to indicate to programs they are running in a container. This file is located at \fI/run/.containerenv\fP\&. When using the --privileged flag the .containerenv contains name/value pairs indicating the container engine version, whether the engine is running in rootless mode, the container name and id, as well as the image name and id that the container is based on. .PP When running from a user defined network namespace, the \fI/etc/netns/NSNAME/resolv.conf\fP will be used if it exists, otherwise \fI/etc/resolv.conf\fP will be used. .PP Default settings are defined in \fB\fCcontainers.conf\fR\&. Most settings for remote connections use the servers containers.conf, except when documented in man pages. .SH IMAGE .PP The image is specified using transport:path format. If no transport is specified, the \fB\fCdocker\fR (container registry) transport will be used by default. For remote Podman, including Mac and Windows (excluding WSL2) machines, \fB\fCdocker\fR is the only allowed transport. .PP \fBdir:\fP\fIpath\fP An existing local directory \fIpath\fP storing the manifest, layer tarballs and signatures as individual files. This is a non-standardized format, primarily useful for debugging or noninvasive container inspection. .PP .RS .nf $ podman save --format docker-dir fedora -o /tmp/fedora $ podman run dir:/tmp/fedora echo hello .fi .RE .PP \fBdocker://\fP\fIdocker-reference\fP (Default) An image reference stored in a remote container image registry. Example: "quay.io/podman/stable:latest". The reference can include a path to a specific registry; if it does not, the registries listed in registries.conf will be queried to find a matching image. By default, credentials from \fB\fCpodman login\fR (stored at $XDG_RUNTIME_DIR/containers/auth.json by default) will be used to authenticate; otherwise it falls back to using credentials in $HOME/.docker/config.json. .PP .RS .nf $ podman run registry.fedoraproject.org/fedora:latest echo hello .fi .RE .PP \fBdocker-archive:\fP\fIpath\fP[\fB:\fP\fIdocker-reference\fP] An image stored in the \fB\fCdocker save\fR formatted file. \fIdocker-reference\fP is only used when creating such a file, and it must not contain a digest. .PP .RS .nf $ podman save --format docker-archive fedora -o /tmp/fedora $ podman run docker-archive:/tmp/fedora echo hello .fi .RE .PP \fBdocker-daemon:\fP\fIdocker-reference\fP An image in \fIdocker-reference\fP format stored in the docker daemon internal storage. The \fIdocker-reference\fP can also be an image ID (docker-daemon:algo:digest). .PP .RS .nf $ sudo docker pull fedora $ sudo podman run docker-daemon:docker.io/library/fedora echo hello .fi .RE .PP \fBoci-archive:\fP\fIpath\fP\fB:\fP\fItag\fP An image in a directory compliant with the "Open Container Image Layout Specification" at the specified \fIpath\fP and specified with a \fItag\fP\&. .PP .RS .nf $ podman save --format oci-archive fedora -o /tmp/fedora $ podman run oci-archive:/tmp/fedora echo hello .fi .RE .SH OPTIONS .SS \fB--add-host\fP=\fIhost:ip\fP .PP Add a custom host-to-IP mapping (host:ip) .PP Add a line to /etc/hosts. The format is hostname:ip. The \fB--add-host\fP option can be set multiple times. Conflicts with the \fB--no-hosts\fP option. .SS \fB--annotation\fP=\fIkey=value\fP .PP Add an annotation to the container. This option can be set multiple times. .SS \fB--arch\fP=\fIARCH\fP .PP Override the architecture, defaults to hosts, of the image to be pulled. For example, \fB\fCarm\fR\&. Unless overridden, subsequent lookups of the same image in the local storage will match this architecture, regardless of the host. .SS \fB--attach\fP, \fB-a\fP=\fIstdin\fP | \fIstdout\fP | \fIstderr\fP .PP Attach to STDIN, STDOUT or STDERR. .PP In foreground mode (the default when \fB-d\fP is not specified), \fBpodman run\fP can start the process in the container and attach the console to the process's standard input, output, and error. It can even pretend to be a TTY (this is what most command-line executables expect) and pass along signals. The \fB-a\fP option can be set for each of \fBstdin\fP, \fBstdout\fP, and \fBstderr\fP\&. .SS \fB--authfile\fP=\fIpath\fP .PP Path of the authentication file. Default is \fB\fC${XDG_RUNTIME_DIR}/containers/auth.json\fR, which is set using \fBpodman login\fP\&. If the authorization state is not found there, \fB\fC$HOME/.docker/config.json\fR is checked, which is set using \fBdocker login\fP\&. .PP Note: There is also the option to override the default path of the authentication file by setting the \fB\fCREGISTRY_AUTH_FILE\fR environment variable. This can be done with \fBexport REGISTRY_AUTH_FILE=\fIpath\fP\fP\&. .SS \fB--blkio-weight\fP=\fIweight\fP .PP Block IO relative weight. The \fIweight\fP is a value between \fB10\fP and \fB1000\fP\&. .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--blkio-weight-device\fP=\fIdevice:weight\fP .PP Block IO relative device weight. .SS \fB--cap-add\fP=\fIcapability\fP .PP Add Linux capabilities. .SS \fB--cap-drop\fP=\fIcapability\fP .PP Drop Linux capabilities. .SS \fB--cgroup-conf\fP=\fIKEY=VALUE\fP .PP When running on cgroup v2, specify the cgroup file to write to and its value. For example \fB--cgroup-conf=memory.high=1073741824\fP sets the memory.high limit to 1GB. .SS \fB--cgroup-parent\fP=\fIpath\fP .PP Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist. .SS \fB--cgroupns\fP=\fImode\fP .PP Set the cgroup namespace mode for the container. .RS .IP \(bu 2 \fBhost\fP: use the host's cgroup namespace inside the container. .IP \(bu 2 \fBcontainer:\fP\fIid\fP: join the namespace of the specified container. .IP \(bu 2 \fBprivate\fP: create a new cgroup namespace. .IP \(bu 2 \fBns:\fP\fIpath\fP: join the namespace at the specified path. .RE .PP If the host uses cgroups v1, the default is set to \fBhost\fP\&. On cgroups v2, the default is \fBprivate\fP\&. .SS \fB--cgroups\fP=\fIhow\fP .PP Determines whether the container will create CGroups. .PP Default is \fBenabled\fP\&. .PP The \fBenabled\fP option will create a new cgroup under the cgroup-parent. The \fBdisabled\fP option will force the container to not create CGroups, and thus conflicts with CGroup options (\fB--cgroupns\fP and \fB--cgroup-parent\fP). The \fBno-conmon\fP option disables a new CGroup only for the \fBconmon\fP process. The \fBsplit\fP option splits the current CGroup in two sub-cgroups: one for conmon and one for the container payload. It is not possible to set \fB--cgroup-parent\fP with \fBsplit\fP\&. .SS \fB--chrootdirs\fP=\fIpath\fP .PP Path to a directory inside the container that should be treated as a \fB\fCchroot\fR directory. Any Podman managed file (e.g., /etc/resolv.conf, /etc/hosts, etc/hostname) that is mounted into the root directory will be mounted into that location as well. Multiple directories should be separated with a comma. .SS \fB--cidfile\fP=\fIfile\fP .PP Write the container ID to \fIfile\fP\&. .SS \fB--conmon-pidfile\fP=\fIfile\fP .PP Write the pid of the \fBconmon\fP process to a file. As \fBconmon\fP runs in a separate process than Podman, this is necessary when using systemd to restart Podman containers. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) .SS \fB--cpu-period\fP=\fIlimit\fP .PP Set the CPU period for the Completely Fair Scheduler (CFS), which is a duration in microseconds. Once the container's CPU quota is used up, it will not be scheduled to run until the current period ends. Defaults to 100000 microseconds. .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--cpu-quota\fP=\fIlimit\fP .PP Limit the CPU Completely Fair Scheduler (CFS) quota. .PP Limit the container's CPU usage. By default, containers run with the full CPU resource. The limit is a number in microseconds. If a number is provided, the container will be allowed to use that much CPU time until the CPU period ends (controllable via \fB--cpu-period\fP). .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--cpu-rt-period\fP=\fImicroseconds\fP .PP Limit the CPU real-time period in microseconds. .PP Limit the container's Real Time CPU usage. This option tells the kernel to restrict the container's Real Time CPU usage to the period specified. .PP This option is only supported on cgroups V1 rootful systems. .SS \fB--cpu-rt-runtime\fP=\fImicroseconds\fP .PP Limit the CPU real-time runtime in microseconds. .PP Limit the containers Real Time CPU usage. This option tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex: Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks. .PP The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. .PP This option is only supported on cgroups V1 rootful systems. .SS \fB--cpu-shares\fP, \fB-c\fP=\fIshares\fP .PP CPU shares (relative weight). .PP By default, all containers get the same proportion of CPU cycles. This proportion can be modified by changing the container's CPU share weighting relative to the combined weight of all the running containers. Default weight is \fB1024\fP\&. .PP The proportion will only apply when CPU-intensive processes are running. When tasks in one container are idle, other containers can use the left-over CPU time. The actual amount of CPU time will vary depending on the number of containers running on the system. .PP For example, consider three containers, one has a cpu-share of 1024 and two others have a cpu-share setting of 512. When processes in all three containers attempt to use 100% of CPU, the first container would receive 50% of the total CPU time. If a fourth container is added with a cpu-share of 1024, the first container only gets 33% of the CPU. The remaining containers receive 16.5%, 16.5% and 33% of the CPU. .PP On a multi-core system, the shares of CPU time are distributed over all CPU cores. Even if a container is limited to less than 100% of CPU time, it can use 100% of each individual CPU core. .PP For example, consider a system with more than three cores. If the container \fIC0\fP is started with \fB--cpu-shares=512\fP running one process, and another container \fIC1\fP with \fB--cpu-shares=1024\fP running two processes, this can result in the following division of CPU shares: .TS allbox; l l l l l l l l . \fB\fCPID\fR \fB\fCcontainer\fR \fB\fCCPU\fR \fB\fCCPU share\fR 100 C0 0 100% of CPU0 101 C1 1 100% of CPU1 102 C1 2 100% of CPU2 .TE .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--cpus\fP=\fInumber\fP .PP Number of CPUs. The default is \fI0.0\fP which means no limit. This is shorthand for \fB--cpu-period\fP and \fB--cpu-quota\fP, so you may only set either \fB--cpus\fP or \fB--cpu-period\fP and \fB--cpu-quota\fP\&. .PP On some systems, changing the CPU limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--cpuset-cpus\fP=\fInumber\fP .PP CPUs in which to allow execution. Can be specified as a comma-separated list (e.g. \fB0,1\fP), as a range (e.g. \fB0-3\fP), or any combination thereof (e.g. \fB0-3,7,11-15\fP). .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--cpuset-mems\fP=\fInodes\fP .PP Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. .PP If there are four memory nodes on the system (0-3), use \fB--cpuset-mems=0,1\fP then processes in the container will only use memory from the first two memory nodes. .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--detach\fP, \fB-d\fP .PP Detached mode: run the container in the background and print the new container ID. The default is \fIfalse\fP\&. .PP At any time you can run \fBpodman ps\fP in the other shell to view a list of the running containers. You can reattach to a detached container with \fBpodman attach\fP\&. .PP When attached in the tty mode, you can detach from the container (and leave it running) using a configurable key sequence. The default sequence is \fB\fCctrl-p,ctrl-q\fR\&. Specify the key sequence using the \fB--detach-keys\fP option, or configure it in the \fBcontainers.conf\fP file: see \fBcontainers.conf(5)\fP for more information. .SS \fB--detach-keys\fP=\fIsequence\fP .PP Specify the key sequence for detaching a container. Format is a single character \fB\fC[a-Z]\fR or one or more \fB\fCctrl-\fR characters where \fB\fC\fR is one of: \fB\fCa-z\fR, \fB\fC@\fR, \fB\fC^\fR, \fB\fC[\fR, \fB\fC,\fR or \fB\fC_\fR\&. Specifying "" will disable this feature. The default is \fIctrl-p,ctrl-q\fP\&. .PP This option can also be set in \fBcontainers.conf\fP(5) file. .SS \fB--device\fP=\fIhost-device[:container-device][:permissions]\fP .PP Add a host device to the container. Optional \fIpermissions\fP parameter can be used to specify device permissions by combining \fBr\fP for read, \fBw\fP for write, and \fBm\fP for \fBmknod\fP(2). .PP Example: \fB--device=/dev/sdc:/dev/xvdc:rwm\fP\&. .PP Note: if \fIhost-device\fP is a symbolic link then it will be resolved first. The container will only store the major and minor numbers of the host device. .PP Podman may load kernel modules required for using the specified device. The devices that Podman will load modules for when necessary are: /dev/fuse. .PP In rootless mode, the new device is bind mounted in the container from the host rather than Podman creating it within the container space. Because the bind mount retains its SELinux label on SELinux systems, the container can get permission denied when accessing the mounted device. Modify SELinux settings to allow containers to use all device labels via the following command: .PP $ sudo setsebool -P container_use_devices=true .PP Note: if the user only has access rights via a group, accessing the device from inside a rootless container will fail. Use the \fB\fC--group-add keep-groups\fR flag to pass the user's supplementary group access into the container. .SS \fB--device-cgroup-rule\fP=\fI"type major:minor mode"\fP .PP Add a rule to the cgroup allowed devices list. The rule is expected to be in the format specified in the Linux kernel documentation (Documentation/cgroup-v1/devices.txt): - type: a (all), c (char), or b (block); - major and minor: either a number, or * for all; - mode: a composition of r (read), w (write), and m (mknod(2)). .SS \fB--device-read-bps\fP=\fIpath:rate\fP .PP Limit read rate (in bytes per second) from a device (e.g. \fB--device-read-bps=/dev/sda:1mb\fP). .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--device-read-iops\fP=\fIpath:rate\fP .PP Limit read rate (in IO operations per second) from a device (e.g. \fB--device-read-iops=/dev/sda:1000\fP). .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--device-write-bps\fP=\fIpath:rate\fP .PP Limit write rate (in bytes per second) to a device (e.g. \fB--device-write-bps=/dev/sda:1mb\fP). .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--device-write-iops\fP=\fIpath:rate\fP .PP Limit write rate (in IO operations per second) to a device (e.g. \fB--device-write-iops=/dev/sda:1000\fP). .PP On some systems, changing the resource limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--disable-content-trust\fP .PP This is a Docker-specific option to disable image verification to a container registry and is not supported by Podman. This option is a NOOP and provided solely for scripting compatibility. .SS \fB--dns\fP=\fIipaddr\fP .PP Set custom DNS servers. .PP This option can be used to override the DNS configuration passed to the container. Typically this is necessary when the host DNS configuration is invalid for the container (e.g., \fB127.0.0.1\fP). When this is the case the \fB--dns\fP flag is necessary for every run. .PP The special value \fBnone\fP can be specified to disable creation of \fI/etc/resolv.conf\fP in the container by Podman. The \fI/etc/resolv.conf\fP file in the image will be used without changes. .PP This option cannot be combined with \fB--network\fP that is set to \fBnone\fP or \fBcontainer:\fP\fIid\fP\&. .SS \fB--dns-option\fP=\fIoption\fP .PP Set custom DNS options. Invalid if using \fB--dns-option\fP with \fB--network\fP that is set to \fBnone\fP or \fBcontainer:\fP\fIid\fP\&. .SS \fB--dns-search\fP=\fIdomain\fP .PP Set custom DNS search domains. Invalid if using \fB--dns-search\fP with \fB--network\fP that is set to \fBnone\fP or \fBcontainer:\fP\fIid\fP\&. Use \fB--dns-search=.\fP if you don't wish to set the search domain. .SS \fB--entrypoint\fP=\fI"command"\fP | \fI\&'["command", "arg1", ...]'\fP .PP Overwrite the default ENTRYPOINT of the image. .PP This option allows you to overwrite the default entrypoint of the image. .PP The ENTRYPOINT of an image is similar to a COMMAND because it specifies what executable to run when the container starts, but it is (purposely) more difficult to override. The ENTRYPOINT gives a container its default nature or behavior, so that when you set an ENTRYPOINT you can run the container as if it were that binary, complete with default options, and you can pass in more options via the COMMAND. But, sometimes an operator may want to run something else inside the container, so you can override the default ENTRYPOINT at runtime by using a \fB--entrypoint\fP and a string to specify the new ENTRYPOINT. .PP You need to specify multi option commands in the form of a json string. .SS \fB--env\fP, \fB-e\fP=\fIenv\fP .PP Set environment variables. .PP This option allows arbitrary environment variables that are available for the process to be launched inside of the container. If an environment variable is specified without a value, Podman will check the host environment for a value and set the variable only if it is set on the host. As a special case, if an environment variable ending in \fB*\fP is specified without a value, Podman will search the host environment for variables starting with the prefix and will add those variables to the container. .PP See \fBEnvironment\fP \[la]#environment\[ra] note below for precedence and examples. .SS \fB--env-file\fP=\fIfile\fP .PP Read in a line-delimited file of environment variables. .PP See \fBEnvironment\fP \[la]#environment\[ra] note below for precedence and examples. .SS \fB--env-host\fP .PP Use host environment inside of the container. See \fBEnvironment\fP note below for precedence. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) .SS \fB--env-merge\fP=\fIenv\fP .PP Preprocess default environment variables for the containers. For example if image contains environment variable \fB\fChello=world\fR user can preprocess it using \fB\fC--env-merge hello=${hello}-some\fR so new value will be \fB\fChello=world-some\fR\&. .SS \fB--expose\fP=\fIport\fP .PP Expose a port, or a range of ports (e.g. \fB--expose=3300-3310\fP) to set up port redirection on the host system. .SS \fB--gidmap\fP=\fIcontainer_gid:host_gid:amount\fP .PP Run the container in a new user namespace using the supplied GID mapping. This option conflicts with the \fB--userns\fP and \fB--subgidname\fP options. This option provides a way to map host GIDs to container GIDs in the same way as \fB--uidmap\fP maps host UIDs to container UIDs. For details see \fB--uidmap\fP\&. .PP Note: the \fB--gidmap\fP flag cannot be called in conjunction with the \fB--pod\fP flag as a gidmap cannot be set on the container level when in a pod. .SS \fB--group-add\fP=\fIgroup\fP | \fIkeep-groups\fP .PP Assign additional groups to the primary user running within the container process. .RS .IP \(bu 2 \fB\fCkeep-groups\fR is a special flag that tells Podman to keep the supplementary group access. .RE .PP Allows container to use the user's supplementary group access. If file systems or devices are only accessible by the rootless user's group, this flag tells the OCI runtime to pass the group access into the container. Currently only available with the \fB\fCcrun\fR OCI runtime. Note: \fB\fCkeep-groups\fR is exclusive, you cannot add any other groups with this flag. (Not available for remote commands, including Mac and Windows (excluding WSL2) machines) .SS \fB--health-cmd\fP=\fI"command"\fP | \fI\&'["command", "arg1", ...]'\fP .PP Set or alter a healthcheck command for a container. The command is a command to be executed inside your container that determines your container health. The command is required for other healthcheck options to be applied. A value of \fBnone\fP disables existing healthchecks. .PP Multiple options can be passed in the form of a JSON array; otherwise, the command will be interpreted as an argument to \fB/bin/sh -c\fP\&. .SS \fB--health-interval\fP=\fIinterval\fP .PP Set an interval for the healthchecks. An \fIinterval\fP of \fBdisable\fP results in no automatic timer setup. The default is \fB30s\fP\&. .SS \fB--health-on-failure\fP=\fIaction\fP .PP Action to take once the container transitions to an unhealthy state. The default is \fBnone\fP\&. .RS .IP \(bu 2 \fBnone\fP: Take no action. .IP \(bu 2 \fBkill\fP: Kill the container. .IP \(bu 2 \fBrestart\fP: Restart the container. Do not combine the \fB\fCrestart\fR action with the \fB\fC--restart\fR flag. When running inside of a systemd unit, consider using the \fB\fCkill\fR or \fB\fCstop\fR action instead to make use of systemd's restart policy. .IP \(bu 2 \fBstop\fP: Stop the container. .RE .SS \fB--health-retries\fP=\fIretries\fP .PP The number of retries allowed before a healthcheck is considered to be unhealthy. The default value is \fB3\fP\&. .SS \fB--health-start-period\fP=\fIperiod\fP .PP The initialization time needed for a container to bootstrap. The value can be expressed in time format like \fB2m3s\fP\&. The default value is \fB0s\fP\&. .SS \fB--health-timeout\fP=\fItimeout\fP .PP The maximum time allowed to complete the healthcheck before an interval is considered failed. Like start-period, the value can be expressed in a time format such as \fB1m22s\fP\&. The default value is \fB30s\fP\&. .SS \fB--help\fP .PP Print usage statement .SS \fB--hostname\fP, \fB-h\fP=\fIname\fP .PP Container host name .PP Sets the container host name that is available inside the container. Can only be used with a private UTS namespace \fB\fC--uts=private\fR (default). If \fB\fC--pod\fR is specified and the pod shares the UTS namespace (default) the pod's hostname will be used. .SS \fB--hostuser\fP=\fIname\fP .PP Add a user account to /etc/passwd from the host to the container. The Username or UID must exist on the host system. .SS \fB--http-proxy\fP .PP By default proxy environment variables are passed into the container if set for the Podman process. This can be disabled by setting the value to \fBfalse\fP\&. The environment variables passed in include \fBhttp_proxy\fP, \fBhttps_proxy\fP, \fBftp_proxy\fP, \fBno_proxy\fP, and also the upper case versions of those. This option is only needed when the host system must use a proxy but the container should not use any proxy. Proxy environment variables specified for the container in any other way will override the values that would have been passed through from the host. (Other ways to specify the proxy for the container include passing the values with the \fB--env\fP flag, or hard coding the proxy environment at container build time.) (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) .PP Defaults to \fBtrue\fP\&. .SS \fB--image-volume\fP=\fBbind\fP | \fItmpfs\fP | \fIignore\fP .PP Tells Podman how to handle the builtin image volumes. Default is \fBbind\fP\&. .RS .IP \(bu 2 \fBbind\fP: An anonymous named volume will be created and mounted into the container. .IP \(bu 2 \fBtmpfs\fP: The volume is mounted onto the container as a tmpfs, which allows the users to create content that disappears when the container is stopped. .IP \(bu 2 \fBignore\fP: All volumes are just ignored and no action is taken. .RE .SS \fB--init\fP .PP Run an init inside the container that forwards signals and reaps processes. The container-init binary is mounted at \fB\fC/run/podman-init\fR\&. Mounting over \fB\fC/run\fR will hence break container execution. .SS \fB--init-path\fP=\fIpath\fP .PP Path to the container-init binary. .SS \fB--interactive\fP, \fB-i\fP .PP When set to \fBtrue\fP, keep stdin open even if not attached. The default is \fBfalse\fP\&. .SS \fB--ip\fP=\fIipv4\fP .PP Specify a static IPv4 address for the container, for example \fB10.88.64.128\fP\&. This option can only be used if the container is joined to only a single network - i.e., \fB--network=network-name\fP is used at most once - and if the container is not joining another container's network namespace via \fB--network=container:\fIid\fP\fP\&. The address must be within the network's IP address pool (default \fB10.88.0.0/16\fP). .PP To specify multiple static IP addresses per container, set multiple networks using the \fB--network\fP option with a static IP address specified for each using the \fB\fCip\fR mode for that option. .SS \fB--ip6\fP=\fIipv6\fP .PP Specify a static IPv6 address for the container, for example \fBfd46:db93:aa76:ac37::10\fP\&. This option can only be used if the container is joined to only a single network - i.e., \fB--network=network-name\fP is used at most once - and if the container is not joining another container's network namespace via \fB--network=container:\fIid\fP\fP\&. The address must be within the network's IPv6 address pool. .PP To specify multiple static IPv6 addresses per container, set multiple networks using the \fB--network\fP option with a static IPv6 address specified for each using the \fB\fCip6\fR mode for that option. .SS \fB--ipc\fP=\fIipc\fP .PP Set the IPC namespace mode for a container. The default is to create a private IPC namespace. .RS .IP \(bu 2 "": Use Podman's default, defined in containers.conf. .IP \(bu 2 \fBcontainer:\fP\fIid\fP: reuses another container's shared memory, semaphores, and message queues .IP \(bu 2 \fBhost\fP: use the host's shared memory, semaphores, and message queues inside the container. Note: the host mode gives the container full access to local shared memory and is therefore considered insecure. .IP \(bu 2 \fBnone\fP: private IPC namespace, with /dev/shm not mounted. .IP \(bu 2 \fBns:\fP\fIpath\fP: path to an IPC namespace to join. .IP \(bu 2 \fBprivate\fP: private IPC namespace. = \fBshareable\fP: private IPC namespace with a possibility to share it with other containers. .RE .SS \fB--label\fP, \fB-l\fP=\fIkey=value\fP .PP Add metadata to a container. .SS \fB--label-file\fP=\fIfile\fP .PP Read in a line-delimited file of labels. .SS \fB--link-local-ip\fP=\fIip\fP .PP Not implemented. .SS \fB--log-driver\fP=\fIdriver\fP .PP Logging driver for the container. Currently available options are \fBk8s-file\fP, \fBjournald\fP, \fBnone\fP and \fBpassthrough\fP, with \fBjson-file\fP aliased to \fBk8s-file\fP for scripting compatibility. (Default \fBjournald\fP). .PP The podman info command below will display the default log-driver for the system. .PP .RS .nf $ podman info --format '{{ .Host.LogDriver }}' journald .fi .RE .PP The \fBpassthrough\fP driver passes down the standard streams (stdin, stdout, stderr) to the container. It is not allowed with the remote Podman client, including Mac and Windows (excluding WSL2) machines, and on a tty, since it is vulnerable to attacks via TIOCSTI. .SS \fB--log-opt\fP=\fIname=value\fP .PP Logging driver specific options. .PP Set custom logging configuration. The following *name*s are supported: .PP \fBpath\fP: specify a path to the log file (e.g. \fB--log-opt path=/var/log/container/mycontainer.json\fP); .PP \fBmax-size\fP: specify a max size of the log file (e.g. \fB--log-opt max-size=10mb\fP); .PP \fBtag\fP: specify a custom log tag for the container (e.g. \fB--log-opt tag="{{.ImageName}}"\fP\&. It supports the same keys as \fBpodman inspect --format\fP\&. This option is currently supported only by the \fBjournald\fP log driver. .SS \fB--mac-address\fP=\fIaddress\fP .PP Container network interface MAC address (e.g. 92:d0:c6:0a:29:33) This option can only be used if the container is joined to only a single network - i.e., \fB--network=\fInetwork-name\fP\fP is used at most once - and if the container is not joining another container's network namespace via \fB--network=container:\fIid\fP\fP\&. .PP Remember that the MAC address in an Ethernet network must be unique. The IPv6 link-local address will be based on the device's MAC address according to RFC4862. .PP To specify multiple static MAC addresses per container, set multiple networks using the \fB--network\fP option with a static MAC address specified for each using the \fB\fCmac\fR mode for that option. .SS \fB--memory\fP, \fB-m\fP=\fInumber[unit]\fP .PP Memory limit. A \fIunit\fP can be \fBb\fP (bytes), \fBk\fP (kibibytes), \fBm\fP (mebibytes), or \fBg\fP (gibibytes). .PP Allows the memory available to a container to be constrained. If the host supports swap memory, then the \fB-m\fP memory setting can be larger than physical RAM. If a limit of 0 is specified (not using \fB-m\fP), the container's memory is not limited. The actual limit may be rounded up to a multiple of the operating system's page size (the value would be very large, that's millions of trillions). .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--memory-reservation\fP=\fInumber[unit]\fP .PP Memory soft limit. A \fIunit\fP can be \fBb\fP (bytes), \fBk\fP (kibibytes), \fBm\fP (mebibytes), or \fBg\fP (gibibytes). .PP After setting memory reservation, when the system detects memory contention or low memory, containers are forced to restrict their consumption to their reservation. So you should always set the value below \fB--memory\fP, otherwise the hard limit will take precedence. By default, memory reservation will be the same as memory limit. .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--memory-swap\fP=\fInumber[unit]\fP .PP A limit value equal to memory plus swap. A \fIunit\fP can be \fBb\fP (bytes), \fBk\fP (kibibytes), \fBm\fP (mebibytes), or \fBg\fP (gibibytes). .PP Must be used with the \fB-m\fP (\fB--memory\fP) flag. The argument value should always be larger than that of \fB-m\fP (\fB--memory\fP) By default, it is set to double the value of \fB--memory\fP\&. .PP Set \fInumber\fP to \fB-1\fP to enable unlimited swap. .PP This option is not supported on cgroups V1 rootless systems. .SS \fB--memory-swappiness\fP=\fInumber\fP .PP Tune a container's memory swappiness behavior. Accepts an integer between \fI0\fP and \fI100\fP\&. .PP This flag is only supported on cgroups V1 rootful systems. .SS \fB--mount\fP=\fItype=TYPE,TYPE-SPECIFIC-OPTION[,...]\fP .PP Attach a filesystem mount to the container .PP Current supported mount TYPEs are \fBbind\fP, \fBvolume\fP, \fBimage\fP, \fBtmpfs\fP and \fBdevpts\fP\&. [1] \[la]#Footnote1\[ra] .PP .RS .nf e.g. type=bind,source=/path/on/host,destination=/path/in/container type=bind,src=/path/on/host,dst=/path/in/container,relabel=shared type=bind,src=/path/on/host,dst=/path/in/container,relabel=shared,U=true type=volume,source=vol1,destination=/path/in/container,ro=true type=tmpfs,tmpfs-size=512M,destination=/path/in/container type=image,source=fedora,destination=/fedora-image,rw=true type=devpts,destination=/dev/pts Common Options: · src, source: mount source spec for bind and volume. Mandatory for bind. · dst, destination, target: mount destination spec. Options specific to volume: · ro, readonly: true or false (default). . U, chown: true or false (default). Change recursively the owner and group of the source volume based on the UID and GID of the container. · idmap: true or false (default). If specified, create an idmapped mount to the target user namespace in the container. Options specific to image: · rw, readwrite: true or false (default). Options specific to bind: · ro, readonly: true or false (default). · bind-propagation: shared, slave, private, unbindable, rshared, rslave, runbindable, or rprivate(default). See also mount(2). . bind-nonrecursive: do not set up a recursive bind mount. By default it is recursive. . relabel: shared, private. · idmap: true or false (default). If specified, create an idmapped mount to the target user namespace in the container. . U, chown: true or false (default). Change recursively the owner and group of the source volume based on the UID and GID of the container. Options specific to tmpfs: · ro, readonly: true or false (default). · tmpfs-size: Size of the tmpfs mount in bytes. Unlimited by default in Linux. · tmpfs-mode: File mode of the tmpfs in octal. (e.g. 700 or 0700.) Defaults to 1777 in Linux. · tmpcopyup: Enable copyup from the image directory at the same location to the tmpfs. Used by default. · notmpcopyup: Disable copying files from the image to the tmpfs. . U, chown: true or false (default). Change recursively the owner and group of the source volume based on the UID and GID of the container. Options specific to devpts: · uid: UID of the file owner (default 0). · gid: GID of the file owner (default 0). · mode: permission mask for the file (default 600). · max: maximum number of PTYs (default 1048576). .fi .RE .SS \fB--name\fP=\fIname\fP .PP Assign a name to the container. .PP The operator can identify a container in three ways: .RS .IP \(bu 2 UUID long identifier (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”); .IP \(bu 2 UUID short identifier (“f78375b1c487”); .IP \(bu 2 Name (“jonah”). .RE .PP Podman generates a UUID for each container, and if a name is not assigned to the container with \fB--name\fP then it will generate a random string name. The name is useful any place you need to identify a container. This works for both background and foreground containers. .SS \fB--network\fP=\fImode\fP, \fB--net\fP .PP Set the network mode for the container. .PP Valid \fImode\fP values are: .RS .IP \(bu 2 \fBbridge[:OPTIONS,...]\fP: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options: .RS .IP \(bu 2 \fBalias=name\fP: Add network-scoped alias for the container. .IP \(bu 2 \fBip=IPv4\fP: Specify a static ipv4 address for this container. .IP \(bu 2 \fBip=IPv6\fP: Specify a static ipv6 address for this container. .IP \(bu 2 \fBmac=MAC\fP: Specify a static mac address for this container. .IP \(bu 2 \fBinterface_name\fP: Specify a name for the created network interface inside the container. .RE .RE .PP For example to set a static ipv4 address and a static mac address, use \fB\fC--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99\fR\&. - [:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by \fBpodman network create\fP\&. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the \fB--network\fP option multiple times to specify additional networks. - \fBnone\fP: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity. - \fBcontainer:\fP\fIid\fP: Reuse another container's network stack. - \fBhost\fP: Do not create a network namespace, the container will use the host's network. Note: The host mode gives the container full access to local system services such as D-bus and is therefore considered insecure. - \fBns:\fP\fIpath\fP: Path to a network namespace to join. - \fBprivate\fP: Create a new namespace for the container. This will use the \fBbridge\fP mode for rootful containers and \fBslirp4netns\fP for rootless ones. - \fBslirp4netns[:OPTIONS,...]\fP: use \fBslirp4netns\fP(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options, they can also be set with \fB\fCnetwork_cmd_options\fR in containers.conf: - \fBallow_host_loopback=true|false\fP: Allow slirp4netns to reach the host loopback IP (default is 10.0.2.2 or the second IP from slirp4netns cidr subnet when changed, see the cidr option below). The default is false. - \fBmtu=MTU\fP: Specify the MTU to use for this network. (Default is \fB\fC65520\fR). - \fBcidr=CIDR\fP: Specify ip range to use for this network. (Default is \fB\fC10.0.2.0/24\fR). - \fBenable_ipv6=true|false\fP: Enable IPv6. Default is true. (Required for \fB\fCoutbound_addr6\fR). - \fBoutbound_addr=INTERFACE\fP: Specify the outbound interface slirp should bind to (ipv4 traffic only). - \fBoutbound_addr=IPv4\fP: Specify the outbound ipv4 address slirp should bind to. - \fBoutbound_addr6=INTERFACE\fP: Specify the outbound interface slirp should bind to (ipv6 traffic only). - \fBoutbound_addr6=IPv6\fP: Specify the outbound ipv6 address slirp should bind to. - \fBport_handler=rootlesskit\fP: Use rootlesskit for port forwarding. Default. Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually \fB\fC10.0.2.100\fR\&. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks. - \fBport_handler=slirp4netns\fP: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks. .PP Invalid if using \fB--dns\fP, \fB--dns-option\fP, or \fB--dns-search\fP with \fB--network\fP set to \fBnone\fP or \fBcontainer:\fP\fIid\fP\&. .PP If used together with \fB--pod\fP, the container will not join the pod's network namespace. .SS \fB--network-alias\fP=\fIalias\fP .PP Add a network-scoped alias for the container, setting the alias for all networks that the container joins. To set a name only for a specific network, use the alias option as described under the \fB--network\fP option. If the network has DNS enabled (\fB\fCpodman network inspect -f {{.DNSEnabled}} \fR), these aliases can be used for name resolution on the given network. This option can be specified multiple times. NOTE: When using CNI a container will only have access to aliases on the first network that it joins. This limitation does not exist with netavark/aardvark-dns. .SS \fB--no-healthcheck\fP .PP Disable any defined healthchecks for container. .SS \fB--no-hosts\fP .PP Do not create \fI/etc/hosts\fP for the container. By default, Podman will manage \fI/etc/hosts\fP, adding the container's own IP address and any hosts from \fB--add-host\fP\&. \fB--no-hosts\fP disables this, and the image's \fI/etc/hosts\fP will be preserved unmodified. .PP This option conflicts with \fB--add-host\fP\&. .SS \fB--oom-kill-disable\fP .PP Whether to disable OOM Killer for the container or not. .PP This flag is not supported on cgroups V2 systems. .SS \fB--oom-score-adj\fP=\fInum\fP .PP Tune the host's OOM preferences for containers (accepts values from \fB-1000\fP to \fB1000\fP). .SS \fB--os\fP=\fIOS\fP .PP Override the OS, defaults to hosts, of the image to be pulled. For example, \fB\fCwindows\fR\&. Unless overridden, subsequent lookups of the same image in the local storage will match this OS, regardless of the host. .SS \fB--passwd\fP .PP Allow Podman to add entries to /etc/passwd and /etc/group when used in conjunction with the --user option. This is used to override the Podman provided user setup in favor of entrypoint configurations such as libnss-extrausers. .SS \fB--passwd-entry\fP=\fIENTRY\fP .PP Customize the entry that is written to the \fB\fC/etc/passwd\fR file within the container when \fB\fC--passwd\fR is used. .PP The variables $USERNAME, $UID, $GID, $NAME, $HOME are automatically replaced with their value at runtime. .SS \fB--personality\fP=\fIpersona\fP .PP Personality sets the execution domain via Linux personality(2). .SS \fB--pid\fP=\fImode\fP .PP Set the PID namespace mode for the container. The default is to create a private PID namespace for the container. .RS .IP \(bu 2 \fBcontainer:\fP\fIid\fP: join another container's PID namespace; .IP \(bu 2 \fBhost\fP: use the host's PID namespace for the container. Note the host mode gives the container full access to local PID and is therefore considered insecure; .IP \(bu 2 \fBns:\fP\fIpath\fP: join the specified PID namespace; .IP \(bu 2 \fBprivate\fP: create a new namespace for the container (default). .RE .SS \fB--pidfile\fP=\fIpath\fP .PP When the pidfile location is specified, the container process' PID will be written to the pidfile. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) If the pidfile option is not specified, the container process' PID will be written to /run/containers/storage/${storage-driver}-containers/$CID/userdata/pidfile. .PP After the container is started, the location for the pidfile can be discovered with the following \fB\fCpodman inspect\fR command: .PP .RS .nf $ podman inspect --format '{{ .PidFile }}' $CID /run/containers/storage/${storage-driver}-containers/$CID/userdata/pidfile .fi .RE .SS \fB--pids-limit\fP=\fIlimit\fP .PP Tune the container's pids limit. Set to \fB-1\fP to have unlimited pids for the container. The default is \fB4096\fP on systems that support "pids" cgroup controller. .SS \fB--platform\fP=\fIOS/ARCH\fP .PP Specify the platform for selecting the image. (Conflicts with --arch and --os) The \fB\fC--platform\fR option can be used to override the current architecture and operating system. Unless overridden, subsequent lookups of the same image in the local storage will match this platform, regardless of the host. .SS \fB--pod\fP=\fIname\fP .PP Run container in an existing pod. If you want Podman to make the pod for you, prefix the pod name with \fBnew:\fP\&. To make a pod with more granular options, use the \fBpodman pod create\fP command before creating a container. If a container is run with a pod, and the pod has an infra-container, the infra-container will be started before the container is. .SS \fB--pod-id-file\fP=\fIfile\fP .PP Run container in an existing pod and read the pod's ID from the specified \fIfile\fP\&. If a container is run within a pod, and the pod has an infra-container, the infra-container will be started before the container is. .SS \fB--preserve-fds\fP=\fIN\fP .PP Pass down to the process N additional file descriptors (in addition to 0, 1, 2). The total FDs will be 3+N. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) .SS \fB--privileged\fP .PP Give extended privileges to this container. The default is \fBfalse\fP\&. .PP By default, Podman containers are unprivileged (\fB=false\fP) and cannot, for example, modify parts of the operating system. This is because by default a container is only allowed limited access to devices. A "privileged" container is given the same access to devices as the user launching the container. .PP A privileged container turns off the security features that isolate the container from the host. Dropped Capabilities, limited devices, read-only mount points, Apparmor/SELinux separation, and Seccomp filters are all disabled. .PP Rootless containers cannot have more privileges than the account that launched them. .SS \fB--publish\fP, \fB-p\fP=\fI[[ip:][hostPort]:]containerPort[/protocol]\fP .PP Publish a container's port, or range of ports, to the host. .PP Both \fIhostPort\fP and \fIcontainerPort\fP can be specified as a range of ports. When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range. .PP If host IP is set to 0.0.0.0 or not set at all, the port will be bound on all IPs on the host. .PP By default, Podman will publish TCP ports. To publish a UDP port instead, give \fB\fCudp\fR as protocol. To publish both TCP and UDP ports, set \fB\fC--publish\fR twice, with \fB\fCtcp\fR, and \fB\fCudp\fR as protocols respectively. Rootful containers can also publish ports using the \fB\fCsctp\fR protocol. .PP Host port does not have to be specified (e.g. \fB\fCpodman run -p 127.0.0.1::80\fR). If it is not, the container port will be randomly assigned a port on the host. .PP Use \fBpodman port\fP to see the actual mapping: \fB\fCpodman port $CONTAINER $CONTAINERPORT\fR\&. .PP \fBNote:\fP If a container will be run within a pod, it is not necessary to publish the port for the containers in the pod. The port must only be published by the pod itself. Pod network stacks act like the network stack on the host - you have a variety of containers in the pod, and programs in the container, all sharing a single interface and IP address, and associated ports. If one container binds to a port, no other container can use that port within the pod while it is in use. Containers in the pod can also communicate over localhost by having one container bind to localhost in the pod, and another connect to that port. .SS \fB--publish-all\fP, \fB-P\fP .PP Publish all exposed ports to random ports on the host interfaces. The default is \fBfalse\fP\&. .PP When set to \fBtrue\fP, publish all exposed ports to the host interfaces. If the operator uses \fB-P\fP (or \fB-p\fP) then Podman will make the exposed port accessible on the host and the ports will be available to any client that can reach the host. .PP When using this option, Podman will bind any exposed port to a random port on the host within an ephemeral port range defined by \fI/proc/sys/net/ipv4/ip_local_port_range\fP\&. To find the mapping between the host ports and the exposed ports, use \fBpodman port\fP\&. .SS \fB--pull\fP=\fIpolicy\fP .PP Pull image policy. The default is \fBmissing\fP\&. .RS .IP \(bu 2 \fBalways\fP: Always pull the image and throw an error if the pull fails. .IP \(bu 2 \fBmissing\fP: Pull the image only if it could not be found in the local containers storage. Throw an error if no image could be found and the pull fails. .IP \(bu 2 \fBnever\fP: Never pull the image but use the one from the local containers storage. Throw an error if no image could be found. .IP \(bu 2 \fBnewer\fP: Pull if the image on the registry is newer than the one in the local containers storage. An image is considered to be newer when the digests are different. Comparing the time stamps is prone to errors. Pull errors are suppressed if a local image was found. .RE .SS \fB--quiet\fP, \fB-q\fP .PP Suppress output information when pulling images .SS \fB--read-only\fP .PP Mount the container's root filesystem as read-only. .PP By default a container will have its root filesystem writable allowing processes to write files anywhere. By specifying the \fB--read-only\fP flag, the container will have its root filesystem mounted as read-only prohibiting any writes. .SS \fB--read-only-tmpfs\fP .PP If container is running in \fB--read-only\fP mode, then mount a read-write tmpfs on \fI/run\fP, \fI/tmp\fP, and \fI/var/tmp\fP\&. The default is \fBtrue\fP\&. .SS \fB--replace\fP .PP If another container with the same name already exists, replace and remove it. The default is \fBfalse\fP\&. .SS \fB--requires\fP=\fIcontainer\fP .PP Specify one or more requirements. A requirement is a dependency container that will be started before this container. Containers can be specified by name or ID, with multiple containers being separated by commas. .SS \fB--restart\fP=\fIpolicy\fP .PP Restart policy to follow when containers exit. Restart policy will not take effect if a container is stopped via the \fBpodman kill\fP or \fBpodman stop\fP commands. .PP Valid \fIpolicy\fP values are: .RS .IP \(bu 2 \fB\fCno\fR : Do not restart containers on exit .IP \(bu 2 \fB\fCon-failure[:max_retries]\fR : Restart containers when they exit with a non-zero exit code, retrying indefinitely or until the optional \fImax_retries\fP count is hit .IP \(bu 2 \fB\fCalways\fR : Restart containers when they exit, regardless of status, retrying indefinitely .IP \(bu 2 \fB\fCunless-stopped\fR : Identical to \fBalways\fP .RE .PP Please note that restart will not restart containers after a system reboot. If this functionality is required in your environment, you can invoke Podman from a \fBsystemd.unit\fP(5) file, or create an init script for whichever init system is in use. To generate systemd unit files, please see \fBpodman generate systemd\fP\&. .SS \fB--rm\fP .PP Automatically remove the container when it exits. The default is \fBfalse\fP\&. .SS \fB--rmi\fP .PP After exit of the container, remove the image unless another container is using it. The default is \fIfalse\fP\&. .SS \fB--rootfs\fP .PP If specified, the first argument refers to an exploded container on the file system. .PP This is useful to run a container without requiring any image management, the rootfs of the container is assumed to be managed externally. .PP \fB\fCOverlay Rootfs Mounts\fR .PP The \fB\fC:O\fR flag tells Podman to mount the directory from the rootfs path as storage using the \fB\fCoverlay file system\fR\&. The container processes can modify content within the mount point which is stored in the container storage in a separate directory. In overlay terms, the source directory will be the lower, and the container storage directory will be the upper. Modifications to the mount point are destroyed when the container finishes executing, similar to a tmpfs mount point being unmounted. .PP Note: On \fBSELinux\fP systems, the rootfs needs the correct label, which is by default \fBunconfined_u:object_r:container_file_t:s0\fP\&. .SS \fB--sdnotify\fP=\fBcontainer\fP | \fIconmon\fP | \fIignore\fP .PP Determines how to use the NOTIFY_SOCKET, as passed with systemd and Type=notify. .PP Default is \fBcontainer\fP, which means allow the OCI runtime to proxy the socket into the container to receive ready notification. Podman will set the MAINPID to conmon's pid. The \fBconmon\fP option sets MAINPID to conmon's pid, and sends READY when the container has started. The socket is never passed to the runtime or the container. The \fBignore\fP option removes NOTIFY_SOCKET from the environment for itself and child processes, for the case where some other process above Podman uses NOTIFY_SOCKET and Podman should not use it. .SS \fB--seccomp-policy\fP=\fIpolicy\fP .PP Specify the policy to select the seccomp profile. If set to \fIimage\fP, Podman will look for a "io.containers.seccomp.profile" label in the container-image config and use its value as a seccomp profile. Otherwise, Podman will follow the \fIdefault\fP policy by applying the default profile unless specified otherwise via \fI--security-opt seccomp\fP as described below. .PP Note that this feature is experimental and may change in the future. .SS \fB--secret\fP=\fIsecret[,opt=opt ...]\fP .PP Give the container access to a secret. Can be specified multiple times. .PP A secret is a blob of sensitive data which a container needs at runtime but should not be stored in the image or in source control, such as usernames and passwords, TLS certificates and keys, SSH keys or other important generic strings or binary content (up to 500 kb in size). .PP When secrets are specified as type \fB\fCmount\fR, the secrets are copied and mounted into the container when a container is created. When secrets are specified as type \fB\fCenv\fR, the secret will be set as an environment variable within the container. Secrets are written in the container at the time of container creation, and modifying the secret using \fB\fCpodman secret\fR commands after the container is created will not affect the secret inside the container. .PP Secrets and its storage are managed using the \fB\fCpodman secret\fR command. .PP Secret Options .RS .IP \(bu 2 \fB\fCtype=mount|env\fR : How the secret will be exposed to the container. Default mount. .IP \(bu 2 \fB\fCtarget=target\fR : Target of secret. Defaults to secret name. .IP \(bu 2 \fB\fCuid=0\fR : UID of secret. Defaults to 0. Mount secret type only. .IP \(bu 2 \fB\fCgid=0\fR : GID of secret. Defaults to 0. Mount secret type only. .IP \(bu 2 \fB\fCmode=0\fR : Mode of secret. Defaults to 0444. Mount secret type only. .RE .SS \fB--security-opt\fP=\fIoption\fP .PP Security Options .RS .IP \(bu 2 \fBapparmor=unconfined\fP : Turn off apparmor confinement for the container .IP \(bu 2 \fBapparmor\fP=\fIyour-profile\fP : Set the apparmor confinement profile for the container .IP \(bu 2 \fBlabel=user:\fP\fIUSER\fP: Set the label user for the container processes .IP \(bu 2 \fBlabel=role:\fP\fIROLE\fP: Set the label role for the container processes .IP \(bu 2 \fBlabel=type:\fP\fITYPE\fP: Set the label process type for the container processes .IP \(bu 2 \fBlabel=level:\fP\fILEVEL\fP: Set the label level for the container processes .IP \(bu 2 \fBlabel=filetype:\fPTYPE_: Set the label file type for the container files .IP \(bu 2 \fBlabel=disable\fP: Turn off label separation for the container .RE .PP Note: Labeling can be disabled for all containers by setting label=false in the \fBcontainers.conf\fP (\fB\fC/etc/containers/containers.conf\fR or \fB\fC$HOME/.config/containers/containers.conf\fR) file. .RS .IP \(bu 2 \fBmask\fP=\fI/path/1:/path/2\fP: The paths to mask separated by a colon. A masked path cannot be accessed inside the container. .IP \(bu 2 \fBno-new-privileges\fP: Disable container processes from gaining additional privileges .IP \(bu 2 \fBseccomp=unconfined\fP: Turn off seccomp confinement for the container. .IP \(bu 2 \fBseccomp=profile.json\fP: JSON file to be used as a seccomp filter. Note that the \fB\fCio.podman.annotations.seccomp\fR annotation is set with the specified value as shown in \fB\fCpodman inspect\fR\&. .IP \(bu 2 \fBproc-opts\fP=\fIOPTIONS\fP : Comma-separated list of options to use for the /proc mount. More details for the possible mount options are specified in the \fBproc(5)\fP man page. .IP \(bu 2 \fBunmask\fP=\fIALL\fP or \fI/path/1:/path/2\fP, or shell expanded paths (/proc/*): Paths to unmask separated by a colon. If set to \fBALL\fP, it will unmask all the paths that are masked or made read-only by default. The default masked paths are \fB/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.\fP\&. The default paths that are read-only are \fB/proc/asound\fP, \fB/proc/bus\fP, \fB/proc/fs\fP, \fB/proc/irq\fP, \fB/proc/sys\fP, \fB/proc/sysrq-trigger\fP, \fB/sys/fs/cgroup\fP\&. .RE .PP Note: Labeling can be disabled for all containers by setting \fBlabel=false\fP in the \fBcontainers.conf\fP(5) file. .SS \fB--shm-size\fP=\fInumber[unit]\fP .PP Size of \fI/dev/shm\fP\&. A \fIunit\fP can be \fBb\fP (bytes), \fBk\fP (kibibytes), \fBm\fP (mebibytes), or \fBg\fP (gibibytes). If the unit is omitted, the system uses bytes. If the size is omitted, the default is \fB64m\fP\&. When \fIsize\fP is \fB0\fP, there is no limit on the amount of memory used for IPC by the container. This option conflicts with \fB--ipc=host\fP\&. .SS \fB--sig-proxy\fP .PP Proxy received signals to the container process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. .PP The default is \fBtrue\fP\&. .SS \fB--stop-signal\fP=\fIsignal\fP .PP Signal to stop a container. Default is \fBSIGTERM\fP\&. .SS \fB--stop-timeout\fP=\fIseconds\fP .PP Timeout to stop a container. Default is \fB10\fP\&. Remote connections use local containers.conf for defaults .SS \fB--subgidname\fP=\fIname\fP .PP Run the container in a new user namespace using the map with \fIname\fP in the \fI/etc/subgid\fP file. If running rootless, the user needs to have the right to use the mapping. See \fBsubgid\fP(5). This flag conflicts with \fB--userns\fP and \fB--gidmap\fP\&. .SS \fB--subuidname\fP=\fIname\fP .PP Run the container in a new user namespace using the map with \fIname\fP in the \fI/etc/subuid\fP file. If running rootless, the user needs to have the right to use the mapping. See \fBsubuid\fP(5). This flag conflicts with \fB--userns\fP and \fB--uidmap\fP\&. .SS \fB--sysctl\fP=\fIname=value\fP .PP Configure namespaced kernel parameters at runtime. .PP For the IPC namespace, the following sysctls are allowed: .RS .IP \(bu 2 kernel.msgmax .IP \(bu 2 kernel.msgmnb .IP \(bu 2 kernel.msgmni .IP \(bu 2 kernel.sem .IP \(bu 2 kernel.shmall .IP \(bu 2 kernel.shmmax .IP \(bu 2 kernel.shmmni .IP \(bu 2 kernel.shm_rmid_forced .IP \(bu 2 Sysctls beginning with fs.mqueue.* .RE .PP Note: if you use the \fB--ipc=host\fP option, the above sysctls are not allowed. .PP For the network namespace, only sysctls beginning with net.* are allowed. .PP Note: if you use the \fB--network=host\fP option, the above sysctls are not allowed. .SS \fB--systemd\fP=\fItrue\fP | \fIfalse\fP | \fIalways\fP .PP Run container in systemd mode. The default is \fBtrue\fP\&. .PP The value \fIalways\fP enforces the systemd mode is enforced without looking at the executable name. Otherwise, if set to true and the command you are running inside the container is \fBsystemd\fP, \fB/usr/sbin/init\fP, \fB/sbin/init\fP or \fB/usr/local/sbin/init\fP\&. .PP Running the container in systemd mode causes the following changes: .RS .IP \(bu 2 Podman mounts tmpfs file systems on the following directories .RS .IP \(bu 2 \fI/run\fP .IP \(bu 2 \fI/run/lock\fP .IP \(bu 2 \fI/tmp\fP .IP \(bu 2 \fI/sys/fs/cgroup/systemd\fP .IP \(bu 2 \fI/var/lib/journal\fP .RE .IP \(bu 2 Podman sets the default stop signal to \fBSIGRTMIN+3\fP\&. .IP \(bu 2 Podman sets \fBcontainer_uuid\fP environment variable in the container to the first 32 characters of the container id. .RE .PP This allows systemd to run in a confined container without any modifications. .PP Note that on \fBSELinux\fP systems, systemd attempts to write to the cgroup file system. Containers writing to the cgroup file system are denied by default. The \fBcontainer_manage_cgroup\fP boolean must be enabled for this to be allowed on an SELinux separated system. .PP .RS .nf setsebool -P container_manage_cgroup true .fi .RE .SS \fB--timeout\fP=\fIseconds\fP .PP Maximum time a container is allowed to run before conmon sends it the kill signal. By default containers will run until they exit or are stopped by \fB\fCpodman stop\fR\&. .SS \fB--tls-verify\fP .PP Require HTTPS and verify certificates when contacting registries (default: \fBtrue\fP). If explicitly set to \fBtrue\fP, TLS verification will be used. If set to \fBfalse\fP, TLS verification will not be used. If not specified, TLS verification will be used unless the target registry is listed as an insecure registry in \fBcontainers-registries.conf(5)\fP .SS \fB--tmpfs\fP=\fIfs\fP .PP Create a tmpfs mount. .PP Mount a temporary filesystem (\fBtmpfs\fP) mount into a container, for example: .PP .RS .nf $ podman run -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image .fi .RE .PP This command mounts a \fBtmpfs\fP at \fI/tmp\fP within the container. The supported mount options are the same as the Linux default mount flags. If you do not specify any options, the system uses the following options: \fBrw,noexec,nosuid,nodev\fP\&. .SS \fB--tty\fP, \fB-t\fP .PP Allocate a pseudo-TTY. The default is \fBfalse\fP\&. .PP When set to \fBtrue\fP, Podman will allocate a pseudo-tty and attach to the standard input of the container. This can be used, for example, to run a throwaway interactive shell. .PP \fBNOTE\fP: The --tty flag prevents redirection of standard output. It combines STDOUT and STDERR, it can insert control characters, and it can hang pipes. This option should only be used when run interactively in a terminal. When feeding input to Podman, use -i only, not -it. .PP .RS .nf echo "asdf" | podman run --rm -i someimage /bin/cat .fi .RE .SS \fB--tz\fP=\fItimezone\fP .PP Set timezone in container. This flag takes area-based timezones, GMT time, as well as \fB\fClocal\fR, which sets the timezone in the container to match the host machine. See \fB\fC/usr/share/zoneinfo/\fR for valid timezones. Remote connections use local containers.conf for defaults .SS \fB--uidmap\fP=\fIcontainer_uid:from_uid:amount\fP .PP Run the container in a new user namespace using the supplied UID mapping. This option conflicts with the \fB--userns\fP and \fB--subuidname\fP options. This option provides a way to map host UIDs to container UIDs. It can be passed several times to map different ranges. .PP The _from\fIuid\fP value is based upon the user running the command, either rootful or rootless users. * rootful user: \fIcontainer_uid\fP:\fIhost_uid\fP:\fIamount\fP * rootless user: \fIcontainer_uid\fP:\fIintermediate_uid\fP:\fIamount\fP .PP When \fBpodman run\fP is called by a privileged user, the option \fB--uidmap\fP works as a direct mapping between host UIDs and container UIDs. .PP host UID -> container UID .PP The \fIamount\fP specifies the number of consecutive UIDs that will be mapped. If for example \fIamount\fP is \fB4\fP the mapping would look like: .PP | host UID | container UID | | - | - | | _from\fIuid\fP | _container\fIuid\fP | | _from\fIuid\fP + 1 | _container\fIuid\fP + 1 | | _from\fIuid\fP + 2 | _container\fIuid\fP + 2 | | _from\fIuid\fP + 3 | _container\fIuid\fP + 3 | .PP When \fBpodman run\fP is called by an unprivileged user (i.e. running rootless), the value _from\fIuid\fP is interpreted as an "intermediate UID". In the rootless case, host UIDs are not mapped directly to container UIDs. Instead the mapping happens over two mapping steps: .PP host UID -> intermediate UID -> container UID .PP The \fB--uidmap\fP option only influences the second mapping step. .PP The first mapping step is derived by Podman from the contents of the file \fI/etc/subuid\fP and the UID of the user calling Podman. .PP First mapping step: .PP | host UID | intermediate UID | | - | - | | UID for the user starting Podman | 0 | | 1st subordinate UID for the user starting Podman | 1 | | 2nd subordinate UID for the user starting Podman | 2 | | 3rd subordinate UID for the user starting Podman | 3 | | nth subordinate UID for the user starting Podman | n | .PP To be able to use intermediate UIDs greater than zero, the user needs to have subordinate UIDs configured in \fI/etc/subuid\fP\&. See \fBsubuid\fP(5). .PP The second mapping step is configured with \fB--uidmap\fP\&. .PP If for example \fIamount\fP is \fB5\fP the second mapping step would look like: .PP | intermediate UID | container UID | | - | - | | _from\fIuid\fP | _container\fIuid\fP | | _from\fIuid\fP + 1 | _container\fIuid\fP + 1 | | _from\fIuid\fP + 2 | _container\fIuid\fP + 2 | | _from\fIuid\fP + 3 | _container\fIuid\fP + 3 | | _from\fIuid\fP + 4 | _container\fIuid\fP + 4 | .PP When running as rootless, Podman will use all the ranges configured in the \fI/etc/subuid\fP file. .PP The current user ID is mapped to UID=0 in the rootless user namespace. Every additional range is added sequentially afterward: .PP | host |rootless user namespace | length | | - | - | - | | $UID | 0 | 1 | | 1 | $FIRST_RANGE_ID | $FIRST_RANGE_LENGTH | | 1+$FIRST_RANGE_LENGTH | $SECOND_RANGE_ID | $SECOND_RANGE_LENGTH| .PP Even if a user does not have any subordinate UIDs in \fI/etc/subuid\fP, \fB--uidmap\fP could still be used to map the normal UID of the user to a container UID by running \fB\fCpodman run --uidmap $container_uid:0:1 --user $container_uid ...\fR\&. .PP Note: the \fB--uidmap\fP flag cannot be called in conjunction with the \fB--pod\fP flag as a uidmap cannot be set on the container level when in a pod. .SS \fB--ulimit\fP=\fIoption\fP .PP Ulimit options. You can use \fBhost\fP to copy the current configuration from the host. .SS \fB--umask\fP=\fIumask\fP .PP Set the umask inside the container. Defaults to \fB\fC0022\fR\&. Remote connections use local containers.conf for defaults .SS \fB--unsetenv\fP=\fIenv\fP .PP Unset default environment variables for the container. Default environment variables include variables provided natively by Podman, environment variables configured by the image, and environment variables from containers.conf. .SS \fB--unsetenv-all\fP .PP Unset all default environment variables for the container. Default environment variables include variables provided natively by Podman, environment variables configured by the image, and environment variables from containers.conf. .SS \fB--user\fP, \fB-u\fP=\fIuser[:group]\fP .PP Sets the username or UID used and, optionally, the groupname or GID for the specified command. Both \fIuser\fP and \fIgroup\fP may be symbolic or numeric. .PP Without this argument, the command will run as the user specified in the container image. Unless overridden by a \fB\fCUSER\fR command in the Containerfile or by a value passed to this option, this user generally defaults to root. .PP When a user namespace is not in use, the UID and GID used within the container and on the host will match. When user namespaces are in use, however, the UID and GID in the container may correspond to another UID and GID on the host. In rootless containers, for example, a user namespace is always used, and root in the container will by default correspond to the UID and GID of the user invoking Podman. .SS \fB--userns\fP=\fImode\fP .PP Set the user namespace mode for the container. It defaults to the \fBPODMAN_USERNS\fP environment variable. An empty value ("") means user namespaces are disabled unless an explicit mapping is set with the \fB--uidmap\fP and \fB--gidmap\fP options. .PP This option is incompatible with \fB--gidmap\fP, \fB--uidmap\fP, \fB--subuidname\fP and \fB--subgidname\fP\&. .PP Rootless user --userns=Key mappings: .TS allbox; l l l l l l . \fB\fCKey\fR \fB\fCHost User\fR \fB\fCContainer User\fR "" $UID T{ 0 (Default User account mapped to root user in container.) T} keep-id $UID T{ $UID (Map user account to same UID within container.) T} auto $UID T{ nil (Host User UID is not mapped into container.) T} nomap $UID T{ nil (Host User UID is not mapped into container.) T} .TE .PP Valid \fImode\fP values are: .PP \fBauto\fP[:\fIOPTIONS,...\fP]: automatically create a unique user namespace. .PP The \fB\fC--userns=auto\fR flag, requires that the user name \fB\fCcontainers\fR and a range of subordinate user ids that the Podman container is allowed to use be specified in the /etc/subuid and /etc/subgid files. .PP Example: \fB\fCcontainers:2147483647:2147483648\fR\&. .PP Podman allocates unique ranges of UIDs and GIDs from the \fB\fCcontainers\fR subordinate user ids. The size of the ranges is based on the number of UIDs required in the image. The number of UIDs and GIDs can be overridden with the \fB\fCsize\fR option. .PP The rootless option \fB\fC--userns=keep-id\fR uses all the subuids and subgids of the user. Using \fB\fC--userns=auto\fR when starting new containers will not work as long as any containers exist that were started with \fB\fC--userns=keep-id\fR\&. .PP Valid \fB\fCauto\fR options: .RS .IP \(bu 2 \fIgidmapping\fP=_CONTAINER_GID:HOST\fIGID:SIZE\fP: to force a GID mapping to be present in the user namespace. .IP \(bu 2 \fIsize\fP=\fISIZE\fP: to specify an explicit size for the automatic user namespace. e.g. \fB\fC--userns=auto:size=8192\fR\&. If \fB\fCsize\fR is not specified, \fB\fCauto\fR will estimate a size for the user namespace. .IP \(bu 2 \fIuidmapping\fP=_CONTAINER_UID:HOST\fIUID:SIZE\fP: to force a UID mapping to be present in the user namespace. .RE .PP \fBcontainer:\fP\fIid\fP: join the user namespace of the specified container. .PP \fBhost\fP: run in the user namespace of the caller. The processes running in the container will have the same privileges on the host as any other process launched by the calling user (default). .PP \fBkeep-id\fP: creates a user namespace where the current rootless user's UID:GID are mapped to the same values in the container. This option is not allowed for containers created by the root user. .PP Valid \fB\fCkeep-id\fR options: .RS .IP \(bu 2 \fIuid\fP=UID: override the UID inside the container that will be used to map the current rootless user to. .IP \(bu 2 \fIgid\fP=GID: override the GID inside the container that will be used to map the current rootless user to. .RE .PP \fBnomap\fP: creates a user namespace where the current rootless user's UID:GID are not mapped into the container. This option is not allowed for containers created by the root user. .PP \fBns:\fP\fInamespace\fP: run the container in the given existing user namespace. .SS \fB--uts\fP=\fImode\fP .PP Set the UTS namespace mode for the container. The following values are supported: .RS .IP \(bu 2 \fBhost\fP: use the host's UTS namespace inside the container. .IP \(bu 2 \fBprivate\fP: create a new namespace for the container (default). .IP \(bu 2 \fBns:[path]\fP: run the container in the given existing UTS namespace. .IP \(bu 2 \fBcontainer:[container]\fP: join the UTS namespace of the specified container. .RE .SS \fB--variant\fP=\fIVARIANT\fP .PP Use \fIVARIANT\fP instead of the default architecture variant of the container image. Some images can use multiple variants of the arm architectures, such as arm/v5 and arm/v7. .SS \fB--volume\fP, \fB-v\fP=\fI[[SOURCE-VOLUME|HOST-DIR:]CONTAINER-DIR[:OPTIONS]]\fP .PP Create a bind mount. If \fB\fC-v /HOST-DIR:/CONTAINER-DIR\fR is specified, Podman bind mounts \fB\fC/HOST-DIR\fR from the host into \fB\fC/CONTAINER-DIR\fR in the Podman container. Similarly, \fB\fC-v SOURCE-VOLUME:/CONTAINER-DIR\fR will mount the named volume from the host into the container. If no such named volume exists, Podman will create one. If no source is given, the volume will be created as an anonymously named volume with a randomly generated name, and will be removed when the container is removed via the \fB\fC--rm\fR flag or the \fB\fCpodman rm --volumes\fR command. .PP (Note when using the remote client, including Mac and Windows (excluding WSL2) machines, the volumes will be mounted from the remote server, not necessarily the client machine.) .PP The \fIOPTIONS\fP is a comma-separated list and can be: [1] \[la]#Footnote1\[ra] .RS .IP \(bu 2 \fBrw\fP|\fBro\fP .IP \(bu 2 \fBz\fP|\fBZ\fP .IP \(bu 2 [\fBO\fP] .IP \(bu 2 [\fBU\fP] .IP \(bu 2 [\fBno\fP]\fBcopy\fP .IP \(bu 2 [\fBno\fP]\fBdev\fP .IP \(bu 2 [\fBno\fP]\fBexec\fP .IP \(bu 2 [\fBno\fP]\fBsuid\fP .IP \(bu 2 [\fBr\fP]\fBbind\fP .IP \(bu 2 [\fBr\fP]\fBshared\fP|[\fBr\fP]\fBslave\fP|[\fBr\fP]\fBprivate\fP[\fBr\fP]\fBunbindable\fP .RE .PP The \fB\fCCONTAINER-DIR\fR must be an absolute path such as \fB\fC/src/docs\fR\&. The volume will be mounted into the container at this directory. .PP 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 will return an error. Users must pre-create the source files or directories. .PP Any source that does not begin with a \fB\fC\&.\fR or \fB\fC/\fR will be treated as the name of a named volume. If a volume with that name does not exist, it will be created. Volumes created with names are not anonymous, and they are not removed by the \fB\fC--rm\fR option and the \fB\fCpodman rm --volumes\fR command. .PP Specify multiple \fB-v\fP options to mount one or more volumes into a container. .PP \fB\fCWrite Protected Volume Mounts\fR .PP Add \fB:ro\fP or \fB:rw\fP option to mount a volume in read-only or read-write mode, respectively. By default, the volumes are mounted read-write. See examples. .PP \fB\fCChowning Volume Mounts\fR .PP By default, Podman does not change the owner and group of source volume directories mounted into containers. 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. .PP The \fB\fC:U\fR 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. .PP \fBWarning\fP use with caution since this will modify the host filesystem. .PP \fB\fCLabeling Volume Mounts\fR .PP 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. .PP To change a label in the container context, add either of two suffixes \fB:z\fP or \fB:Z\fP to the volume mount. These suffixes tell Podman to relabel file objects on the shared volumes. The \fBz\fP option tells Podman that two 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 \fBZ\fP option tells Podman to label the content with a private unshared label. Only the current container can use a private volume. .PP Note: Do not relabel system files and directories. Relabeling system content might cause other confined services on your machine to fail. For these types of containers we recommend disabling SELinux separation. The option \fB--security-opt label=disable\fP 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. .PP .RS .nf $ podman run --security-opt label=disable -v $HOME:/home/user fedora touch /home/user/file .fi .RE .PP \fB\fCOverlay Volume Mounts\fR .PP The \fB\fC:O\fR flag tells Podman to mount the directory from the host as a temporary storage using the \fB\fCoverlay file system\fR\&. 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 will be the lower, and the container storage directory will be the upper. Modifications to the mount point are destroyed when the container finishes executing, similar to a tmpfs mount point being unmounted. .PP For advanced users, the \fBoverlay\fP option also supports custom non-volatile \fBupperdir\fP and \fBworkdir\fP for the overlay mount. Custom \fBupperdir\fP and \fBworkdir\fP can be fully managed by the users themselves, and Podman will not remove it on lifecycle completion. Example \fB:O,upperdir=/some/upper,workdir=/some/work\fP .PP Subsequent executions of the container will see the original source directory content, any changes from previous container executions no longer exist. .PP One use case of the overlay mount is sharing the package cache from the host into the container to allow speeding up builds. .PP Note: .PP .RS .nf - The `O` flag conflicts with other options listed above. .fi .RE .PP 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 \fB\fCcontainer_share_t\fR and can read/write \fB\fCcontainer_file_t\fR\&. If unable to change the labels on a source volume, SELinux container separation must be disabled for the container to work. - The source directory mounted into the container with an overlay mount should not be modified, it can cause unexpected failures. It is recommended to not modify the directory until the container finishes running. .PP \fB\fCMounts propagation\fR .PP By default bind mounted volumes are \fB\fCprivate\fR\&. That means any mounts done inside the container will not be visible on host and vice versa. One can change this behavior by specifying a volume mount propagation property. Making a volume shared mounts done under that volume inside the container will be visible on host and vice versa. Making a volume \fBslave\fP enables only one way mount propagation and that is mounts done on host under that volume will be visible inside container but not the other way around. [1] \[la]#Footnote1\[ra] .PP To control mount propagation property of a volume one can use the [\fBr\fP]\fBshared\fP, [\fBr\fP]\fBslave\fP, [\fBr\fP]\fBprivate\fP or the [\fBr\fP]\fBunbindable\fP 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] \[la]#Footnote1\[ra] .PP To recursively mount a volume and all of its submounts into a container, use the \fBrbind\fP option. By default the bind option is used, and submounts of the source directory will not be mounted into the container. .PP Mounting the volume with the \fBnosuid\fP options means that SUID applications on the volume will not be able to change their privilege. By default volumes are mounted with \fBnosuid\fP\&. .PP Mounting the volume with the \fBnoexec\fP option means that no executables on the volume will be able to be executed within the container. .PP Mounting the volume with the \fBnodev\fP option means that no devices on the volume will be able to be used by processes within the container. By default volumes are mounted with \fBnodev\fP\&. .PP If the \fIHOST-DIR\fP is a mount point, then \fBdev\fP, \fBsuid\fP, and \fBexec\fP options are ignored by the kernel. .PP Use \fBdf HOST-DIR\fP to figure out the source mount, then use \fBfindmnt -o TARGET,PROPAGATION \fIsource-mount-dir\fP\fP to figure out propagation properties of source mount. If \fBfindmnt\fP(1) utility is not available, then one can look at the mount entry for the source mount point in \fI/proc/self/mountinfo\fP\&. Look at the "optional fields" and see if any propagation properties are specified. In there, \fBshared:N\fP means the mount is shared, \fBmaster:N\fP means mount is slave, and if nothing is there, the mount is private. [1] \[la]#Footnote1\[ra] .PP To change propagation properties of a mount point, use \fBmount\fP(8) command. For example, if one wants to bind mount source directory \fI/foo\fP, one can do \fBmount --bind /foo /foo\fP and \fBmount --make-private --make-shared /foo\fP\&. This will convert /foo into a shared mount point. Alternatively, one can directly change propagation properties of source mount. Say \fI/\fP is source mount for \fI/foo\fP, then use \fBmount --make-shared /\fP to convert \fI/\fP into a shared mount. .PP Note: if the user only has access rights via a group, accessing the volume from inside a rootless container will fail. .PP Use the \fB--group-add keep-groups\fP option to pass the user's supplementary group access into the container. .SS \fB--volumes-from\fP=\fICONTAINER[:OPTIONS]\fP .PP Mount volumes from the specified container(s). Used to share volumes between containers. The \fIoptions\fP is a comma-separated list with the following available elements: .RS .IP \(bu 2 \fBrw\fP|\fBro\fP .IP \(bu 2 \fBz\fP .RE .PP Mounts already mounted volumes from a source container onto another container. \fICONTAINER\fP may be a name or ID. To share a volume, use the --volumes-from option when running the target container. Volumes can be shared even if the source container is not running. .PP By default, Podman mounts the volumes in the same mode (read-write or read-only) as it is mounted in the source container. This can be changed by adding a \fB\fCro\fR or \fB\fCrw\fR \fIoption\fP\&. .PP 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. .PP To change a label in the container context, add \fB\fCz\fR to the volume mount. This suffix tells Podman to relabel file objects on the shared volumes. The \fB\fCz\fR option tells Podman that two entities 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. .PP If the location of the volume from the source container overlaps with data residing on a target container, then the volume hides that data on the target. .SS \fB--workdir\fP, \fB-w\fP=\fIdir\fP .PP Working directory inside the container. .PP The default working directory for running binaries within a container is the root directory (\fB/\fP). The image developer can set a different default with the WORKDIR instruction. The operator can override the working directory by using the \fB-w\fP option. .SH Exit Status .PP The exit code from \fBpodman run\fP gives information about why the container failed to run or why it exited. When \fBpodman run\fP exits with a non-zero code, the exit codes follow the \fBchroot\fP(1) standard, see below: .PP \fB125\fP The error is with Podman itself .PP .RS .nf $ podman run --foo busybox; echo $? Error: unknown flag: --foo 125 .fi .RE .PP \fB126\fP The \fIcontained command\fP cannot be invoked .PP .RS .nf $ podman run busybox /etc; echo $? Error: container_linux.go:346: starting container process caused "exec: \\"/etc\\": permission denied": OCI runtime error 126 .fi .RE .PP \fB127\fP The \fIcontained command\fP cannot be found .PP .RS .nf $ podman run busybox foo; echo $? Error: container_linux.go:346: starting container process caused "exec: \\"foo\\": executable file not found in $PATH": OCI runtime error 127 .fi .RE .PP \fBExit code\fP \fIcontained command\fP exit code .PP .RS .nf $ podman run busybox /bin/sh -c 'exit 3'; echo $? 3 .fi .RE .SH EXAMPLES .SS Running container in read-only mode .PP During container image development, containers often need to write to the image content. Installing packages into \fI/usr\fP, for example. In production, applications seldom need to write to the image. Container applications write to volumes if they need to write to file systems at all. Applications can be made more secure by running them in read-only mode using the \fB--read-only\fP switch. This protects the container's image from modification. Read-only containers may still need to write temporary data. The best way to handle this is to mount tmpfs directories on \fI/run\fP and \fI/tmp\fP\&. .PP .RS .nf $ podman run --read-only -i -t fedora /bin/bash $ podman run --read-only --read-only-tmpfs=false --tmpfs /run -i -t fedora /bin/bash .fi .RE .SS Exposing log messages from the container to the host's log .PP If you want messages that are logged in your container to show up in the host's syslog/journal then you should bind mount the \fI/dev/log\fP directory as follows. .PP .RS .nf $ podman run -v /dev/log:/dev/log -i -t fedora /bin/bash .fi .RE .PP From inside the container you can test this by sending a message to the log. .PP .RS .nf (bash)# logger "Hello from my container" .fi .RE .PP Then exit and check the journal. .PP .RS .nf (bash)# exit $ journalctl -b | grep Hello .fi .RE .PP This should list the message sent to logger. .SS Attaching to one or more from STDIN, STDOUT, STDERR .PP If you do not specify \fB-a\fP, Podman will attach everything (stdin, stdout, stderr). You can specify to which of the three standard streams (stdin, stdout, stderr) you'd like to connect instead, as in: .PP .RS .nf $ podman run -a stdin -a stdout -i -t fedora /bin/bash .fi .RE .SS Sharing IPC between containers .PP Using \fBshm_server.c\fP available here: https://www.cs.cf.ac.uk/Dave/C/node27.html .PP Testing \fB--ipc=host\fP mode: .PP Host shows a shared memory segment with 7 pids attached, happens to be from httpd: .PP .RS .nf $ sudo ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x01128e25 0 root 600 1000 7 .fi .RE .PP Now run a regular container, and it correctly does NOT see the shared memory segment from the host: .PP .RS .nf $ podman run -it shm ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status .fi .RE .PP Run a container with the new \fB--ipc=host\fP option, and it now sees the shared memory segment from the host httpd: .PP .RS .nf $ podman run -it --ipc=host shm ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x01128e25 0 root 600 1000 7 .fi .RE .PP Testing \fB--ipc=container:\fP\fIid\fP mode: .PP Start a container with a program to create a shared memory segment: .PP .RS .nf $ podman run -it shm bash $ sudo shm/shm_server & $ sudo ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0000162e 0 root 666 27 1 .fi .RE .PP Create a 2nd container correctly shows no shared memory segment from 1st container: .PP .RS .nf $ podman run shm ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status .fi .RE .PP Create a 3rd container using the \fB--ipc=container:\fP\fIid\fP option, now it shows the shared memory segment from the first: .PP .RS .nf $ podman run -it --ipc=container:ed735b2264ac shm ipcs -m $ sudo ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0000162e 0 root 666 27 1 .fi .RE .SS Mapping Ports for External Usage .PP The exposed port of an application can be mapped to a host port using the \fB-p\fP flag. For example, an httpd port 80 can be mapped to the host port 8080 using the following: .PP .RS .nf $ podman run -p 8080:80 -d -i -t fedora/httpd .fi .RE .SS Mounting External Volumes .PP To mount a host directory as a container volume, specify the absolute path to the directory and the absolute path for the container directory separated by a colon. If the source is a named volume maintained by Podman, it is recommended to use its name rather than the path to the volume. Otherwise the volume will be considered as an orphan and wiped if you execute \fBpodman volume prune\fP: .PP .RS .nf $ podman run -v /var/db:/data1 -i -t fedora bash $ podman run -v data:/data2 -i -t fedora bash $ podman run -v /var/cache/dnf:/var/cache/dnf:O -ti fedora dnf -y update $ podman run -d -e MYSQL_ROOT_PASSWORD=root --user mysql --userns=keep-id -v ~/data:/var/lib/mysql:z,U mariadb .fi .RE .PP Using \fB--mount\fP flags to mount a host directory as a container folder, specify the absolute path to the directory or the volume name, and the absolute path within the container directory: .PP .RS .nf $ podman run --mount type=bind,src=/var/db,target=/data1 busybox sh $ podman run --mount type=bind,src=volume-name,target=/data1 busybox sh .fi .RE .PP When using SELinux, be aware that the host has no knowledge of container SELinux policy. Therefore, in the above example, if SELinux policy is enforced, the \fI/var/db\fP directory is not writable to the container. A "Permission Denied" message will occur and an \fBavc:\fP message in the host's syslog. .PP To work around this, at time of writing this man page, the following command needs to be run in order for the proper SELinux policy type label to be attached to the host directory: .PP .RS .nf $ chcon -Rt svirt_sandbox_file_t /var/db .fi .RE .PP Now, writing to the \fI/data1\fP volume in the container will be allowed and the changes will also be reflected on the host in \fI/var/db\fP\&. .SS Using alternative security labeling .PP You can override the default labeling scheme for each container by specifying the \fB--security-opt\fP flag. For example, you can specify the MCS/MLS level, a requirement for MLS systems. Specifying the level in the following command allows you to share the same content between containers. .PP .RS .nf podman run --security-opt label=level:s0:c100,c200 -i -t fedora bash .fi .RE .PP An MLS example might be: .PP .RS .nf $ podman run --security-opt label=level:TopSecret -i -t rhel7 bash .fi .RE .PP To disable the security labeling for this container versus running with the .SS \fB--permissive\fP flag, use the following command: .PP .RS .nf $ podman run --security-opt label=disable -i -t fedora bash .fi .RE .PP If you want a tighter security policy on the processes within a container, you can specify an alternate type for the container. You could run a container that is only allowed to listen on Apache ports by executing the following command: .PP .RS .nf $ podman run --security-opt label=type:svirt_apache_t -i -t centos bash .fi .RE .PP Note you would have to write policy defining a \fBsvirt_apache_t\fP type. .PP To mask additional specific paths in the container, specify the paths separated by a colon using the \fBmask\fP option with the \fB--security-opt\fP flag. .PP .RS .nf $ podman run --security-opt mask=/foo/bar:/second/path fedora bash .fi .RE .PP To unmask all the paths that are masked by default, set the \fBunmask\fP option to \fBALL\fP\&. Or to only unmask specific paths, specify the paths as shown above with the \fBmask\fP option. .PP .RS .nf $ podman run --security-opt unmask=ALL fedora bash .fi .RE .PP To unmask all the paths that start with /proc, set the \fBunmask\fP option to \fB/proc/\fP*. .PP .RS .nf $ podman run --security-opt unmask=/proc/* fedora bash .fi .RE .PP .RS .nf $ podman run --security-opt unmask=/foo/bar:/sys/firmware fedora bash .fi .RE .SS Setting device weight .PP If you want to set \fI/dev/sda\fP device weight to \fB200\fP, you can specify the device weight by \fB--blkio-weight-device\fP flag. Use the following command: .PP .RS .nf $ podman run -it --blkio-weight-device "/dev/sda:200" ubuntu .fi .RE .SS Using a podman container with input from a pipe .PP .RS .nf $ echo "asdf" | podman run --rm -i --entrypoint /bin/cat someimage asdf .fi .RE .SS Setting automatic user namespace separated containers .PP .RS .nf # podman run --userns=auto:size=65536 ubi8-micro cat /proc/self/uid_map 0 2147483647 65536 # podman run --userns=auto:size=65536 ubi8-micro cat /proc/self/uid_map 0 2147549183 65536 .fi .RE .SS Setting Namespaced Kernel Parameters (Sysctls) .PP The \fB--sysctl\fP sets namespaced kernel parameters (sysctls) in the container. For example, to turn on IP forwarding in the containers network namespace, run this command: .PP .RS .nf $ podman run --sysctl net.ipv4.ip_forward=1 someimage .fi .RE .PP Note that not all sysctls are namespaced. Podman does not support changing sysctls inside of a container that also modify the host system. As the kernel evolves we expect to see more sysctls become namespaced. .PP See the definition of the \fB--sysctl\fP option above for the current list of supported sysctls. .SS Set UID/GID mapping in a new user namespace .PP Running a container in a new user namespace requires a mapping of the uids and gids from the host. .PP .RS .nf $ podman run --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello .fi .RE .SS Configuring Storage Options from the command line .PP Podman allows for the configuration of storage by changing the values in the \fI/etc/container/storage.conf\fP or by using global options. This shows how to set up and use fuse-overlayfs for a one-time run of busybox using global options. .PP .RS .nf podman --log-level=debug --storage-driver overlay --storage-opt "overlay.mount_program=/usr/bin/fuse-overlayfs" run busybox /bin/sh .fi .RE .SS Configure timezone in a container .PP .RS .nf $ podman run --tz=local alpine date $ podman run --tz=Asia/Shanghai alpine date $ podman run --tz=US/Eastern alpine date .fi .RE .SS Adding dependency containers .PP The first container, container1, is not started initially, but must be running before container2 will start. The \fB\fCpodman run\fR command will start the container automatically before starting container2. .PP .RS .nf $ podman create --name container1 -t -i fedora bash $ podman run --name container2 --requires container1 -t -i fedora bash .fi .RE .PP Multiple containers can be required. .PP .RS .nf $ podman create --name container1 -t -i fedora bash $ podman create --name container2 -t -i fedora bash $ podman run --name container3 --requires container1,container2 -t -i fedora bash .fi .RE .SS Configure keep supplemental groups for access to volume .PP .RS .nf $ podman run -v /var/lib/design:/var/lib/design --group-add keep-groups ubi8 .fi .RE .SS Configure execution domain for containers using personality flag .PP .RS .nf $ podman run --name container1 --personality=LINUX32 fedora bash .fi .RE .SS Run a container with external rootfs mounted as an overlay .PP .RS .nf $ podman run --name container1 --rootfs /path/to/rootfs:O bash .fi .RE .SS Handling Timezones in java applications in a container. .PP In order to use a timezone other than UTC when running a Java application within a container, the \fB\fCTZ\fR environment variable must be set within the container. Java applications will ignore the value set with the \fB\fC--tz\fR option. .PP .RS .nf # Example run podman run -ti --rm -e TZ=EST mytzimage lrwxrwxrwx. 1 root root 29 Nov 3 08:51 /etc/localtime -> ../usr/share/zoneinfo/Etc/UTC Now with default timezone: Fri Nov 19 18:10:55 EST 2021 Java default sees the following timezone: 2021-11-19T18:10:55.651130-05:00 Forcing UTC: Fri Nov 19 23:10:55 UTC 2021 .fi .RE .SS Run a container connected to two networks (called net1 and net2) with a static ip .PP .RS .nf $ podman run --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10 alpine ip addr .fi .RE .SS Rootless Containers .PP Podman runs as a non-root user on most systems. This feature requires that a new enough version of \fBshadow-utils\fP be installed. The \fBshadow-utils\fP package must include the \fBnewuidmap\fP(1) and \fBnewgidmap\fP(1) executables. .PP In order for users to run rootless, there must be an entry for their username in \fI/etc/subuid\fP and \fI/etc/subgid\fP which lists the UIDs for their user namespace. .PP Rootless Podman works better if the fuse-overlayfs and slirp4netns packages are installed. The \fBfuse-overlayfs\fP package provides a userspace overlay storage driver, otherwise users need to use the \fBvfs\fP storage driver, which is diskspace expensive and does not perform well. slirp4netns is required for VPN, without it containers need to be run with the \fB--network=host\fP flag. .SH ENVIRONMENT .PP Environment variables within containers can be set using multiple different options, in the following order of precedence (later entries override earlier entries): .RS .IP \(bu 2 Container image: Any environment variables specified in the container image. .IP \(bu 2 \fB--http-proxy\fP: By default, several environment variables will be passed in from the host, such as \fBhttp_proxy\fP and \fBno_proxy\fP\&. See \fB--http-proxy\fP for details. .IP \(bu 2 \fB--env-host\fP: Host environment of the process executing Podman is added. .IP \(bu 2 \fB--env-file\fP: Any environment variables specified via env-files. If multiple files are specified, then they override each other in order of entry. .IP \(bu 2 \fB--env\fP: Any environment variables specified will override previous settings. .RE .PP Run containers and set the environment ending with a \fB*\fP\&. The trailing \fB*\fP glob functionality is only active when no value is specified: .PP .RS .nf $ export ENV1=a $ podman run --env 'ENV*' alpine env | grep ENV ENV1=a $ podman run --env 'ENV*=b' alpine env | grep ENV ENV*=b .fi .RE .SH CONMON .PP When Podman starts a container it actually executes the conmon program, which then executes the OCI Runtime. Conmon is the container monitor. It is a small program whose job is to watch the primary process of the container, and if the container dies, save the exit code. It also holds open the tty of the container, so that it can be attached to later. This is what allows Podman to run in detached mode (backgrounded), so Podman can exit but conmon continues to run. Each container has their own instance of conmon. Conmon waits for the container to exit, gathers and saves the exit code, and then launches a Podman process to complete the container cleanup, by shutting down the network and storage. For more information on conmon, please reference the conmon(8) man page. .SH FILES .PP \fB/etc/subuid\fP .PP \fB/etc/subgid\fP .PP NOTE: Use the environment variable \fB\fCTMPDIR\fR to change the temporary storage location of downloaded container images. Podman defaults to use \fB\fC/var/tmp\fR\&. .SH SEE ALSO .PP \fBpodman(1)\fP, \fBpodman-save(1)\fP, \fBpodman-ps(1)\fP, \fBpodman-attach(1)\fP, \fBpodman-pod-create(1)\fP, \fBpodman-port(1)\fP, \fBpodman-start(1)\fP, \fBpodman-kill(1)\fP, \fBpodman-stop(1)\fP, \fBpodman-generate-systemd(1)\fP, \fBpodman-rm(1)\fP, \fBsubgid(5)\fP, \fBsubuid(5)\fP, \fBcontainers.conf(5)\fP, \fBsystemd.unit(5)\fP, \fBsetsebool(8)\fP, \fBslirp4netns(1)\fP, \fBfuse-overlayfs(1)\fP, \fBproc(5)\fP, \fBconmon(8)\fP, \fBpersonality(2)\fP .SH HISTORY .PP September 2018, updated by Kunal Kushwaha \fB\fC\fR .PP October 2017, converted from Docker documentation to Podman by Dan Walsh for Podman \fB\fC\fR .PP November 2015, updated by Sally O'Malley \fB\fC\fR .PP June 2014, updated by Sven Dowideit \fB\fC\fR .PP April 2014, Originally compiled by William Henry \fB\fC\fR based on docker.com source material and internal work. .SH FOOTNOTES .PP 1: The Podman project is committed to inclusivity, a core value of open source. The \fB\fCmaster\fR and \fB\fCslave\fR mount propagation terminology used here is problematic and divisive, and should be changed. However, these terms are currently used within the Linux kernel and must be used as-is at this time. When the kernel maintainers rectify this usage, Podman will follow suit immediately.