github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/docs/source/markdown/podman-run.1.md (about)

     1  % podman-run(1)
     2  
     3  ## NAME
     4  podman\-run - Run a command in a new container
     5  
     6  ## SYNOPSIS
     7  **podman run** [*options*] *image* [*command* [*arg* ...]]
     8  
     9  **podman container run** [*options*] *image* [*command* [*arg* ...]]
    10  
    11  ## DESCRIPTION
    12  
    13  Run a process in a new container. **podman run** starts a process with its own
    14  file system, its own networking, and its own isolated process tree. The _image_
    15  which starts the process may define defaults related to the process that will be
    16  run in the container, the networking to expose, and more, but **podman run**
    17  gives final control to the operator or administrator who starts the container
    18  from the image. For that reason **podman run** has more options than any other
    19  Podman command.
    20  
    21  If the _image_ is not already loaded then **podman run** will pull the _image_, and
    22  all image dependencies, from the repository in the same way running **podman
    23  pull** _image_ , before it starts the container from that image.
    24  
    25  Several files will be automatically created within the container. These include
    26  _/etc/hosts_, _/etc/hostname_, and _/etc/resolv.conf_ to manage networking.
    27  These will be based on the host's version of the files, though they can be
    28  customized with options (for example, **--dns** will override the host's DNS
    29  servers in the created _resolv.conf_). Additionally, an empty file is created in
    30  each container to indicate to programs they are running in a container. This file
    31  is located at _/run/.containerenv_.
    32  
    33  When running from a user defined network namespace, the _/etc/netns/NSNAME/resolv.conf_
    34  will be used if it exists, otherwise _/etc/resolv.conf_ will be used.
    35  
    36  Default settings are defined in `containers.conf`. Most settings for remote
    37  connections use the servers containers.conf, except when documented in man
    38  pages.
    39  
    40  ## IMAGE
    41  
    42    The image is specified using transport:path format. If no transport is specified, the `docker` (container registry)
    43  transport will be used by default. For remote Podman, `docker` is the only allowed transport.
    44  
    45    **dir:**_path_
    46    An existing local directory _path_ storing the manifest, layer tarballs and signatures as individual files. This
    47  is a non-standardized format, primarily useful for debugging or noninvasive container inspection.
    48  
    49      $ podman save --format docker-dir fedora -o /tmp/fedora
    50      $ podman run dir:/tmp/fedora echo hello
    51  
    52    **docker://**_docker-reference_ (Default)
    53    An image reference stored in a remote container image registry. Example: "quay.io/podman/stable:latest".
    54  The reference can include a path to a specific registry; if it does not, the
    55  registries listed in registries.conf will be queried to find a matching image.
    56  By default, credentials from `podman login` (stored at
    57  $XDG_RUNTIME_DIR/containers/auth.json by default) will be used to authenticate;
    58  otherwise it falls back to using credentials in $HOME/.docker/config.json.
    59  
    60      $ podman run registry.fedoraproject.org/fedora:latest echo hello
    61  
    62    **docker-archive:**_path_[**:**_docker-reference_]
    63  An image stored in the `docker save` formatted file. _docker-reference_ is only used when creating such a
    64  file, and it must not contain a digest.
    65  
    66      $ podman save --format docker-archive fedora -o /tmp/fedora
    67      $ podman run docker-archive:/tmp/fedora echo hello
    68  
    69    **docker-daemon:**_docker-reference_
    70    An image in _docker-reference_ format stored in the docker daemon internal storage. The _docker-reference_ can also be an image ID (docker-daemon:algo:digest).
    71  
    72      $ sudo docker pull fedora
    73      $ sudo podman run docker-daemon:docker.io/library/fedora echo hello
    74  
    75    **oci-archive:**_path_**:**_tag_
    76    An image in a directory compliant with the "Open Container Image Layout Specification" at the specified _path_
    77  and specified with a _tag_.
    78  
    79      $ podman save --format oci-archive fedora -o /tmp/fedora
    80      $ podman run oci-archive:/tmp/fedora echo hello
    81  
    82  ## OPTIONS
    83  #### **--add-host**=_host_:_ip_
    84  
    85  Add a line to container's _/etc/hosts_ for custom host-to-IP mapping.
    86  This option can be set multiple times.
    87  
    88  #### **--annotation**=_key_=_value_
    89  
    90  Add an annotation to the container.
    91  This option can be set multiple times.
    92  
    93  #### **--attach**, **-a**=**stdin**|**stdout**|**stderr**
    94  
    95  Attach to STDIN, STDOUT or STDERR.
    96  
    97  In foreground mode (the default when **-d**
    98  is not specified), **podman run** can start the process in the container
    99  and attach the console to the process's standard input, output, and
   100  error. It can even pretend to be a TTY (this is what most commandline
   101  executables expect) and pass along signals. The **-a** option can be set for
   102  each of **stdin**, **stdout**, and **stderr**.
   103  
   104  #### **--authfile**[=*path*]
   105  
   106  Path to the authentication file. Default is *${XDG_RUNTIME_DIR}/containers/auth.json*.
   107  
   108  Note: You can also override the default path of the authentication file by setting the **REGISTRY_AUTH_FILE**
   109  environment variable.
   110  
   111  #### **--blkio-weight**=*weight*
   112  
   113  Block IO relative weight. The _weight_ is a value between **10** and **1000**.
   114  
   115  #### **--blkio-weight-device**=*device*:*weight*
   116  
   117  Block IO relative device weight.
   118  
   119  #### **--cap-add**=*capability*
   120  
   121  Add Linux capabilities.
   122  
   123  #### **--cap-drop**=*capability*
   124  
   125  Drop Linux capabilities.
   126  
   127  #### **--cgroupns**=*mode*
   128  
   129  Set the cgroup namespace mode for the container.
   130  
   131  - **host**: use the host's cgroup namespace inside the container.
   132  - **container:**_id_: join the namespace of the specified container.
   133  - **private**: create a new cgroup namespace.
   134  - **ns:**_path_: join the namespace at the specified path.
   135  
   136  If the host uses cgroups v1, the default is set to **host**. On cgroups v2, the default is **private**.
   137  
   138  #### **--cgroups**=**enabled**|**disabled**|**no-conmon**|**split**
   139  
   140  Determines whether the container will create CGroups.
   141  
   142  Default is **enabled**.
   143  
   144  The **enabled** option will create a new cgroup under the cgroup-parent.
   145  The **disabled** option will force the container to not create CGroups, and thus conflicts with CGroup options (**--cgroupns** and **--cgroup-parent**).
   146  The **no-conmon** option disables a new CGroup only for the **conmon** process.
   147  The **split** option splits the current cgroup in two sub-cgroups: one for conmon and one for the container payload. It is not possible to set **--cgroup-parent** with **split**.
   148  
   149  #### **--cgroup-parent**=*path*
   150  
   151  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.
   152  
   153  #### **--cgroup-conf**=*KEY=VALUE*
   154  
   155  When running on cgroup v2, specify the cgroup file to write to and its value. For example **--cgroup-conf=memory.high=1073741824** sets the memory.high limit to 1GB.
   156  
   157  #### **--cidfile**=*file*
   158  
   159  Write the container ID to *file*.
   160  
   161  #### **--conmon-pidfile**=*file*
   162  
   163  Write the pid of the **conmon** process to a file. As **conmon** runs in a separate process than Podman, this is necessary when using systemd to restart Podman containers.
   164  
   165  #### **--cpu-period**=*limit*
   166  
   167  Set the CPU period for the Completely Fair Scheduler (CFS), which is a
   168  duration in microseconds. Once the container's CPU quota is used up, it will
   169  not be scheduled to run until the current period ends. Defaults to 100000
   170  microseconds.
   171  
   172  On some systems, changing the CPU limits may not be allowed for non-root
   173  users. For more details, see
   174  https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error
   175  
   176  #### **--cpu-quota**=*limit*
   177  
   178  Limit the CPU Completely Fair Scheduler (CFS) quota.
   179  
   180  Limit the container's CPU usage. By default, containers run with the full
   181  CPU resource. The limit is a number in microseconds. If you provide a number,
   182  the container will be allowed to use that much CPU time until the CPU period
   183  ends (controllable via **--cpu-period**).
   184  
   185  On some systems, changing the CPU limits may not be allowed for non-root
   186  users. For more details, see
   187  https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error
   188  
   189  #### **--cpu-rt-period**=*microseconds*
   190  
   191  Limit the CPU real-time period in microseconds.
   192  
   193  Limit the container's Real Time CPU usage. This flag tell the kernel to restrict the container's Real Time CPU usage to the period you specify.
   194  
   195  #### **--cpu-rt-runtime**=*microseconds*
   196  
   197  Limit the CPU real-time runtime in microseconds.
   198  
   199  Limit the containers Real Time CPU usage. This flag tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex:
   200  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.
   201  
   202  The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup.
   203  
   204  #### **--cpu-shares**=*shares*
   205  
   206  CPU shares (relative weight).
   207  
   208  By default, all containers get the same proportion of CPU cycles. This proportion
   209  can be modified by changing the container's CPU share weighting relative
   210  to the combined weight of all the running containers. Default weight is **1024**.
   211  
   212  The proportion will only apply when CPU-intensive processes are running.
   213  When tasks in one container are idle, other containers can use the
   214  left-over CPU time. The actual amount of CPU time will vary depending on
   215  the number of containers running on the system.
   216  
   217  For example, consider three containers, one has a cpu-share of 1024 and
   218  two others have a cpu-share setting of 512. When processes in all three
   219  containers attempt to use 100% of CPU, the first container would receive
   220  50% of the total CPU time. If you add a fourth container with a cpu-share
   221  of 1024, the first container only gets 33% of the CPU. The remaining containers
   222  receive 16.5%, 16.5% and 33% of the CPU.
   223  
   224  On a multi-core system, the shares of CPU time are distributed over all CPU
   225  cores. Even if a container is limited to less than 100% of CPU time, it can
   226  use 100% of each individual CPU core.
   227  
   228  For example, consider a system with more than three cores. If you start one
   229  container **{C0}** with **--cpu-shares=512** running one process, and another container
   230  **{C1}** with **--cpu-shares=1024** running two processes, this can result in the following
   231  division of CPU shares:
   232  
   233  | PID  |  container  | CPU     | CPU share    |
   234  | ---- | ----------- | ------- | ------------ |
   235  | 100  |  {C0}       | 0       | 100% of CPU0 |
   236  | 101  |  {C1}       | 1       | 100% of CPU1 |
   237  | 102  |  {C1}       | 2       | 100% of CPU2 |
   238  
   239  #### **--cpus**=*number*
   240  
   241  Number of CPUs. The default is *0.0* which means no limit. This is shorthand
   242  for **--cpu-period** and **--cpu-quota**, so you may only set either
   243  #### **--cpus** or **--cpu-period** and **--cpu-quota**.
   244  
   245  On some systems, changing the CPU limits may not be allowed for non-root
   246  users. For more details, see
   247  https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error
   248  
   249  #### **--cpuset-cpus**=*number*
   250  
   251  CPUs in which to allow execution. Can be specified as a comma-separated list
   252  (e.g. **0,1**), as a range (e.g. **0-3**), or any combination thereof
   253  (e.g. **0-3,7,11-15**).
   254  
   255  #### **--cpuset-mems**=*nodes*
   256  
   257  Memory nodes (MEMs) in which to allow execution. Only effective on NUMA systems.
   258  
   259  For example, if you have four memory nodes (0-3) on your system, use **--cpuset-mems=0,1**
   260  to only use memory from the first two memory nodes.
   261  
   262  #### **--detach**, **-d**=**true**|**false**
   263  
   264  Detached mode: run the container in the background and print the new container ID. The default is *false*.
   265  
   266  At any time you can run **podman ps** in
   267  the other shell to view a list of the running containers. You can reattach to a
   268  detached container with **podman attach**.
   269  
   270  When attached in the tty mode, you can detach from the container (and leave it
   271  running) using a configurable key sequence. The default sequence is `ctrl-p,ctrl-q`.
   272  Configure the keys sequence using the **--detach-keys** option, or specifying
   273  it in the **containers.conf** file: see **containers.conf(5)** for more information.
   274  
   275  #### **--detach-keys**=*sequence*
   276  
   277  Specify the key sequence for detaching a container. Format is a single character `[a-Z]` or one or more `ctrl-<value>` characters where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. Specifying "" will disable this feature. The default is *ctrl-p,ctrl-q*.
   278  
   279  This option can also be set in **containers.conf**(5) file.
   280  
   281  Specifying "" will disable this feature. The default is **ctrl-p,ctrl-q**.
   282  
   283  #### **--device**=_host-device_[**:**_container-device_][**:**_permissions_]
   284  
   285  Add a host device to the container. Optional *permissions* parameter
   286  can be used to specify device permissions, it is combination of
   287  **r** for read, **w** for write, and **m** for **mknod**(2).
   288  
   289  Example: **--device=/dev/sdc:/dev/xvdc:rwm**.
   290  
   291  Note: if _host_device_ is a symbolic link then it will be resolved first.
   292  The container will only store the major and minor numbers of the host device.
   293  
   294  Note: if the user only has access rights via a group, accessing the device
   295  from inside a rootless container will fail. The **crun**(1) runtime offers a
   296  workaround for this by adding the option **--annotation run.oci.keep_original_groups=1**.
   297  
   298  Podman may load kernel modules required for using the specified
   299  device. The devices that Podman will load modules when necessary are:
   300  /dev/fuse.
   301  
   302  #### **--device-cgroup-rule**=rule
   303  
   304  Add a rule to the cgroup allowed devices list
   305  
   306  #### **--device-read-bps**=_path_:_rate_
   307  
   308  Limit read rate (in bytes per second) from a device (e.g. **--device-read-bps=/dev/sda:1mb**).
   309  
   310  #### **--device-read-iops**=_path_:_rate_
   311  
   312  Limit read rate (in IO operations per second) from a device (e.g. **--device-read-iops=/dev/sda:1000**).
   313  
   314  #### **--device-write-bps**=_path_:_rate_
   315  
   316  Limit write rate (in bytes per second) to a device (e.g. **--device-write-bps=/dev/sda:1mb**).
   317  
   318  #### **--device-write-iops**=_path_:_rate_
   319  
   320  Limit write rate (in IO operations per second) to a device (e.g. **--device-write-iops=/dev/sda:1000**).
   321  
   322  #### **--disable-content-trust**
   323  
   324  This is a Docker specific option to disable image verification to a Docker
   325  registry and is not supported by Podman. This flag is a NOOP and provided
   326  solely for scripting compatibility.
   327  
   328  #### **--dns**=*ipaddr*
   329  
   330  Set custom DNS servers. Invalid if using **--dns** with **--network** that is set to **none** or **container:**_id_.
   331  
   332  This option can be used to override the DNS
   333  configuration passed to the container. Typically this is necessary when the
   334  host DNS configuration is invalid for the container (e.g., **127.0.0.1**). When this
   335  is the case the **--dns** flags is necessary for every run.
   336  
   337  The special value **none** can be specified to disable creation of _/etc/resolv.conf_ in the container by Podman.
   338  The _/etc/resolv.conf_ file in the image will be used without changes.
   339  
   340  #### **--dns-opt**=*option*
   341  
   342  Set custom DNS options. Invalid if using **--dns-opt** with **--network** that is set to **none** or **container:**_id_.
   343  
   344  #### **--dns-search**=*domain*
   345  
   346  Set custom DNS search domains. Invalid if using **--dns-search** and **--network** that is set to **none** or **container:**_id_.
   347  Use **--dns-search=.** if you don't wish to set the search domain.
   348  
   349  #### **--entrypoint**=*"command"* | *'["command", "arg1", ...]'*
   350  
   351  Overwrite the default ENTRYPOINT of the image.
   352  
   353  This option allows you to overwrite the default entrypoint of the image.
   354  
   355  The ENTRYPOINT of an image is similar to a COMMAND
   356  because it specifies what executable to run when the container starts, but it is
   357  (purposely) more difficult to override. The ENTRYPOINT gives a container its
   358  default nature or behavior, so that when you set an ENTRYPOINT you can run the
   359  container as if it were that binary, complete with default options, and you can
   360  pass in more options via the COMMAND. But, sometimes an operator may want to run
   361  something else inside the container, so you can override the default ENTRYPOINT
   362  at runtime by using a **--entrypoint** and a string to specify the new
   363  ENTRYPOINT.
   364  
   365  You need to specify multi option commands in the form of a json string.
   366  
   367  #### **--env**, **-e**=*env*
   368  
   369  Set environment variables.
   370  
   371  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. If an environment variable ending in __*__ is specified, Podman will search the host environment for variables starting with the prefix and will add those variables to the container. If an environment variable with a trailing ***** is specified, then a value must be supplied.
   372  
   373  See [**Environment**](#environment) note below for precedence and examples.
   374  
   375  #### **--env-host**=**true**|**false**
   376  
   377  Use host environment inside of the container. See **Environment** note below for precedence. (Not available for remote commands)
   378  
   379  #### **--env-file**=*file*
   380  
   381  Read in a line delimited file of environment variables. See **Environment** note below for precedence.
   382  
   383  #### **--expose**=*port*
   384  
   385  Expose a port, or a range of ports (e.g. **--expose=3300-3310**) to set up port redirection
   386  on the host system.
   387  
   388  #### **--gidmap**=*container_gid*:*host_gid*:*amount*
   389  
   390  Run the container in a new user namespace using the supplied mapping. This option conflicts with the **--userns** and **--subgidname** flags.
   391  This option can be passed several times to map different ranges. If calling **podman run** as an unprivileged user, the user needs to have the right to use the mapping. See **subuid**(5).
   392  The example maps gids **0-1999** in the container to the gids **30000-31999** on the host: **--gidmap=0:30000:2000**.
   393  
   394  #### **--group-add**=*group*
   395  
   396  Add additional groups to run as
   397  
   398  #### **--health-cmd**=*"command"* | *'["command", "arg1", ...]'*
   399  
   400  Set or alter a healthcheck command for a container. The command is a command to be executed inside your
   401  container that determines your container health. The command is required for other healthcheck options
   402  to be applied. A value of **none** disables existing healthchecks.
   403  
   404  Multiple options can be passed in the form of a JSON array; otherwise, the command will be interpreted
   405  as an argument to **/bin/sh -c**.
   406  
   407  #### **--health-interval**=*interval*
   408  
   409  Set an interval for the healthchecks. An _interval_ of **disable** results in no automatic timer setup. The default is **30s**.
   410  
   411  #### **--health-retries**=*retries*
   412  
   413  The number of retries allowed before a healthcheck is considered to be unhealthy. The default value is **3**.
   414  
   415  #### **--health-start-period**=*period*
   416  
   417  The initialization time needed for a container to bootstrap. The value can be expressed in time format like
   418  **2m3s**. The default value is **0s**.
   419  
   420  #### **--health-timeout**=*timeout*
   421  
   422  The maximum time allowed to complete the healthcheck before an interval is considered failed. Like start-period, the
   423  value can be expressed in a time format such as **1m22s**. The default value is **30s**.
   424  
   425  #### **--help**
   426  
   427  Print usage statement
   428  
   429  #### **--hostname**=*name*, **-h**
   430  
   431  Container host name
   432  
   433  Sets the container host name that is available inside the container. Can only be used with a private UTS namespace `--uts=private` (default). If `--pod` is specified and the pod shares the UTS namespace (default) the pod's hostname will be used.
   434  
   435  #### **--http-proxy**=**true**|**false**
   436  
   437  By default proxy environment variables are passed into the container if set
   438  for the Podman process. This can be disabled by setting the value to **false**.
   439  The environment variables passed in include **http_proxy**,
   440  **https_proxy**, **ftp_proxy**, **no_proxy**, and also the upper case versions of
   441  those. This option is only needed when the host system must use a proxy but
   442  the container should not use any proxy. Proxy environment variables specified
   443  for the container in any other way will override the values that would have
   444  been passed through from the host. (Other ways to specify the proxy for the
   445  container include passing the values with the **--env** flag, or hard coding the
   446  proxy environment at container build time.) (Not available for remote commands)
   447  
   448  Defaults to **true**.
   449  
   450  #### **--image-volume**, **builtin-volume**=**bind**|**tmpfs**|**ignore**
   451  
   452  Tells Podman how to handle the builtin image volumes. Default is **bind**.
   453  
   454  - **bind**: An anonymous named volume will be created and mounted into the container.
   455  - **tmpfs**: The volume is mounted onto the container as a tmpfs, which allows the users to create
   456  content that disappears when the container is stopped.
   457  - **ignore**: All volumes are just ignored and no action is taken.
   458  
   459  #### **--init**
   460  
   461  Run an init inside the container that forwards signals and reaps processes.
   462  
   463  #### **--init-path**=*path*
   464  
   465  Path to the container-init binary.
   466  
   467  #### **--interactive**, **-i**=**true**|**false**
   468  
   469  When set to **true**, keep stdin open even if not attached. The default is **false**.
   470  
   471  #### **--ip6**=*ip*
   472  
   473  Not implemented.
   474  
   475  #### **--ip**=*ip*
   476  
   477  Specify a static IP address for the container, for example **10.88.64.128**.
   478  This option can only be used if the container is joined to only a single network - i.e., `--network=_network-name_` is used at most once
   479  and if the container is not joining another container's network namespace via `--network=container:_id_`.
   480  The address must be within the CNI network's IP address pool (default **10.88.0.0/16**).
   481  
   482  #### **--ipc**=*mode*
   483  
   484  Set the IPC namespace mode for a container. The default is to create
   485  a private IPC namespace.
   486  
   487  - **container:**_id_: reuses another container shared memory, semaphores and message queues
   488  - **host**: use the host 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.
   489  - **ns:**_path_: path to an IPC namespace to join.
   490  
   491  #### **--kernel-memory**=_number_[_unit_]
   492  
   493  Kernel memory limit. A _unit_ can be **b** (bytes), **k** (kilobytes), **m** (megabytes), or **g** (gigabytes).
   494  
   495  Constrains the kernel memory available to a container. If a limit of 0
   496  is specified (not using *--kernel-memory*), the container's kernel memory
   497  is not limited. If you specify a limit, it may be rounded up to a multiple
   498  of the operating system's page size and the value can be very large,
   499  millions of trillions.
   500  
   501  #### **--label**, **-l**=*key*=*value*
   502  
   503  Add metadata to a container.
   504  
   505  #### **--label-file**=*file*
   506  
   507  Read in a line-delimited file of labels.
   508  
   509  #### **--link-local-ip**=*ip*
   510  
   511  Not implemented.
   512  
   513  #### **--log-driver**="*driver*"
   514  
   515  Logging driver for the container. Currently available options are **k8s-file**, **journald**, and **none**, with **json-file** aliased to **k8s-file** for scripting compatibility.
   516  
   517  #### **--log-opt**=*name*=*value*
   518  
   519  Logging driver specific options.
   520  
   521  Set custom logging configuration. The following *name*s are supported:
   522  
   523  **path**: specify a path to the log file
   524      (e.g. **--log-opt path=/var/log/container/mycontainer.json**);
   525  
   526  **max-size**: specify a max size of the log file
   527      (e.g. **--log-opt max-size=10mb**);
   528  
   529  **tag**: specify a custom log tag for the container
   530     (e.g. **--log-opt tag="{{.ImageName}}"**.
   531  
   532  This option is currently supported only by the **journald** log driver.
   533  
   534  #### **--mac-address**=*address*
   535  
   536  Container MAC address (e.g. **92:d0:c6:0a:29:33**).
   537  
   538  Remember that the MAC address in an Ethernet network must be unique.
   539  The IPv6 link-local address will be based on the device's MAC address
   540  according to RFC4862.
   541  
   542  #### **--memory**, **-m**=_number_[_unit_]
   543  
   544  Memory limit. A _unit_ can be **b** (bytes), **k** (kilobytes), **m** (megabytes), or **g** (gigabytes).
   545  
   546  Allows you to constrain the memory available to a container. If the host
   547  supports swap memory, then the **-m** memory setting can be larger than physical
   548  RAM. If a limit of 0 is specified (not using **-m**), the container's memory is
   549  not limited. The actual limit may be rounded up to a multiple of the operating
   550  system's page size (the value would be very large, that's millions of trillions).
   551  
   552  #### **--memory-reservation**=_number_[_unit_]
   553  
   554  Memory soft limit. A _unit_ can be **b** (bytes), **k** (kilobytes), **m** (megabytes), or **g** (gigabytes).
   555  
   556  After setting memory reservation, when the system detects memory contention
   557  or low memory, containers are forced to restrict their consumption to their
   558  reservation. So you should always set the value below **--memory**, otherwise the
   559  hard limit will take precedence. By default, memory reservation will be the same
   560  as memory limit.
   561  
   562  #### **--memory-swap**=_number_[_unit_]
   563  
   564  A limit value equal to memory plus swap.
   565  A _unit_ can be **b** (bytes), **k** (kilobytes), **m** (megabytes), or **g** (gigabytes).
   566  
   567  Must be used with the **-m** (**--memory**) flag.
   568  The argument value should always be larger than that of
   569   **-m** (**--memory**) By default, it is set to double
   570  the value of **--memory**.
   571  
   572  Set _number_ to **-1** to enable unlimited swap.
   573  
   574  #### **--memory-swappiness**=*number*
   575  
   576  Tune a container's memory swappiness behavior. Accepts an integer between *0* and *100*.
   577  
   578  #### **--mount**=*type=TYPE,TYPE-SPECIFIC-OPTION[,...]*
   579  
   580  Attach a filesystem mount to the container
   581  
   582  Current supported mount TYPEs are **bind**, **volume**, **image**, **tmpfs** and **devpts**. <sup>[[1]](#Footnote1)</sup>
   583  
   584         e.g.
   585  
   586         type=bind,source=/path/on/host,destination=/path/in/container
   587  
   588         type=bind,src=/path/on/host,dst=/path/in/container,relabel=shared
   589  
   590         type=volume,source=vol1,destination=/path/in/container,ro=true
   591  
   592         type=tmpfs,tmpfs-size=512M,destination=/path/in/container
   593  
   594         type=image,source=fedora,destination=/fedora-image,rw=true
   595  
   596         type=devpts,destination=/dev/pts
   597  
   598         Common Options:
   599  
   600  	      · src, source: mount source spec for bind and volume. Mandatory for bind.
   601  
   602  	      · dst, destination, target: mount destination spec.
   603  
   604         Options specific to volume:
   605  
   606  	      · ro, readonly: true or false (default).
   607  
   608         Options specific to image:
   609  
   610  	      · rw, readwrite: true or false (default).
   611  
   612         Options specific to bind:
   613  
   614  	      · ro, readonly: true or false (default).
   615  
   616  	      · bind-propagation: shared, slave, private, unbindable, rshared, rslave, runbindable, or rprivate(default). See also mount(2).
   617  
   618  	      . bind-nonrecursive: do not setup a recursive bind mount. By default it is recursive.
   619  
   620  	      . relabel: shared, private.
   621  
   622         Options specific to tmpfs:
   623  
   624  	      · ro, readonly: true or false (default).
   625  
   626  	      · tmpfs-size: Size of the tmpfs mount in bytes. Unlimited by default in Linux.
   627  
   628  	      · tmpfs-mode: File mode of the tmpfs in octal. (e.g. 700 or 0700.) Defaults to 1777 in Linux.
   629  
   630  	      · tmpcopyup: Enable copyup from the image directory at the same location to the tmpfs. Used by default.
   631  
   632  	      · notmpcopyup: Disable copying files from the image to the tmpfs.
   633  
   634  #### **--name**=*name*
   635  
   636  Assign a name to the container.
   637  
   638  The operator can identify a container in three ways:
   639  
   640  - UUID long identifier (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”);
   641  - UUID short identifier (“f78375b1c487”);
   642  - Name (“jonah”).
   643  
   644  Podman generates a UUID for each container, and if a name is not assigned
   645  to the container with **--name** then it will generate a random
   646  string name. The name is useful any place you need to identify a container.
   647  This works for both background and foreground containers.
   648  
   649  #### **--network**=*mode*, **--net**
   650  
   651  Set the network mode for the container. Invalid if using **--dns**, **--dns-opt**, or **--dns-search** with **--network** that is set to **none** or **container:**_id_. If used together with **--pod**, the container will not join the pods network namespace.
   652  
   653  Valid _mode_ values are:
   654  
   655  - **bridge**: create a network stack on the default bridge;
   656  - **none**: no networking;
   657  - **container:**_id_: reuse another container's network stack;
   658  - **host**: use the Podman host network stack. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure;
   659  - _network-id_: connect to a user-defined network, multiple networks should be comma separated;
   660  - **ns:**_path_: path to a network namespace to join;
   661  - **private**: create a new namespace for the container (default)
   662  - **slirp4netns[:OPTIONS,...]**: use **slirp4netns**(1) to create a user network stack. This is the default for rootless containers. It is possible to specify these additional options:
   663    - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`). Default is false.
   664    - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`).
   665    - **enable_ipv6=true|false**: Enable IPv6. Default is false. (Required for `outbound_addr6`).
   666    - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only).
   667    - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to.
   668    - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only).
   669    - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to.
   670    - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default.
   671    - **port_handler=slirp4netns**: Use the slirp4netns port forwarding.
   672  
   673  #### **--network-alias**=*alias*
   674  
   675  Add network-scoped alias for the container
   676  
   677  #### **--no-healthcheck**=*true|false*
   678  
   679  Disable any defined healthchecks for container.
   680  
   681  #### **--no-hosts**=**true**|**false**
   682  
   683  Do not create _/etc/hosts_ for the container.
   684  
   685  By default, Podman will manage _/etc/hosts_, adding the container's own IP address and any hosts from **--add-host**.
   686  #### **--no-hosts** disables this, and the image's _/etc/hosts_ will be preserved unmodified.
   687  This option conflicts with **--add-host**.
   688  
   689  #### **--oom-kill-disable**=**true**|**false**
   690  
   691  Whether to disable OOM Killer for the container or not.
   692  
   693  #### **--oom-score-adj**=*num*
   694  
   695  Tune the host's OOM preferences for containers (accepts values from **-1000** to **1000**).
   696  
   697  #### **--override-arch**=*ARCH*
   698  Override the architecture, defaults to hosts, of the image to be pulled. For example, `arm`.
   699  
   700  #### **--override-os**=*OS*
   701  Override the OS, defaults to hosts, of the image to be pulled. For example, `windows`.
   702  
   703  #### **--override-variant**=*VARIANT*
   704  Use _VARIANT_ 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.
   705  
   706  #### **--pid**=*mode*
   707  
   708  Set the PID namespace mode for the container.
   709  The efault is to create a private PID namespace for the container.
   710  
   711  - **container:**_id_: join another container's PID namespace;
   712  - **host**: 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;
   713  - **private**: create a new namespace for the container (default)
   714  - **ns:**_path_: join the specified PID namespace.
   715  
   716  #### **--pids-limit**=*limit*
   717  
   718  Tune the container's pids limit. Set to **0** to have unlimited pids for the container. The default is **4096** on systems that support "pids" cgroup controller.
   719  
   720  #### **--pod**=*name*
   721  
   722  Run container in an existing pod. If you want Podman to make the pod for you, prefix the pod name with **new:**.
   723  To make a pod with more granular options, use the **podman pod create** command before creating a container.
   724  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.
   725  
   726  #### **--pod-id-file**=*path*
   727  
   728  Run container in an existing pod and read the pod's ID from the specified file.
   729  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.
   730  
   731  #### **--preserve-fds**=*N*
   732  
   733  Pass down to the process N additional file descriptors (in addition to 0, 1, 2).
   734  The total FDs will be 3+N.
   735  
   736  #### **--privileged**=**true**|**false**
   737  
   738  Give extended privileges to this container. The default is **false**.
   739  
   740  By default, Podman containers are unprivileged (**=false**) and cannot, for
   741  example, modify parts of the operating system. This is because by default a
   742  container is only allowed limited access to devices. A "privileged" container
   743  is given the same access to devices as the user launching the container.
   744  
   745  A privileged container turns off the security features that isolate the
   746  container from the host. Dropped Capabilities, limited devices, read-only mount
   747  points, Apparmor/SELinux separation, and Seccomp filters are all disabled.
   748  
   749  Rootless containers cannot have more privileges than the account that launched them.
   750  
   751  #### **--publish**, **-p**=_ip_:_hostPort_:_containerPort_ | _ip_::_containerPort_ | _hostPort_:_containerPort_ | _containerPort_
   752  
   753  Publish a container's port, or range of ports, to the host.
   754  
   755  Both hostPort and containerPort can be specified as a range of ports.
   756  
   757  When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range.
   758  
   759  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.
   760  
   761  Host port does not have to be specified (e.g. `podman run -p 127.0.0.1::80`).
   762  If it is not, the container port will be randomly assigned a port on the host.
   763  
   764  Use **podman port** to see the actual mapping: **podman port $CONTAINER $CONTAINERPORT**.
   765  
   766  **Note:** if a container will be run within a pod, it is not necessary to publish the port for
   767  the containers in the pod. The port must only be published by the pod itself. Pod network
   768  stacks act like the network stack on the host - you have a variety of containers in the pod,
   769  and programs in the container, all sharing a single interface and IP address, and
   770  associated ports. If one container binds to a port, no other container can use that port
   771  within the pod while it is in use. Containers in the pod can also communicate over localhost
   772  by having one container bind to localhost in the pod, and another connect to that port.
   773  
   774  #### **--publish-all**, **-P**=**true**|**false**
   775  
   776  Publish all exposed ports to random ports on the host interfaces. The default is **false**.
   777  
   778  When set to **true**, publish all exposed ports to the host interfaces. The
   779  default is **false**. If the operator uses **-P** (or **-p**) then Podman will make the
   780  exposed port accessible on the host and the ports will be available to any
   781  client that can reach the host.
   782  
   783  When using this option, Podman will bind any exposed port to a random port on the host
   784  within an ephemeral port range defined by */proc/sys/net/ipv4/ip_local_port_range*.
   785  To find the mapping between the host ports and the exposed ports, use **podman port**.
   786  
   787  #### **--pull**=**always**|**missing**|**never**
   788  
   789  Pull image before running. The default is **missing**.
   790  
   791  - **missing**: attempt to pull the latest image from the registries listed in registries.conf if a local image does not exist.Raise an error if the image is not in any listed registry and is not present locally.
   792  - **always**: Pull the image from the first registry it is found in as listed in registries.conf. Raise an error if not found in the registries, even if the image is present locally.
   793  - **never**: do not pull the image from the registry, use only the local version. Raise an error if the image is not present locally.
   794  
   795  #### **--quiet**, **-q**
   796  
   797  Suppress output information when pulling images
   798  
   799  #### **--read-only**=**true**|**false**
   800  
   801  Mount the container's root filesystem as read only.
   802  
   803  By default a container will have its root filesystem writable allowing processes
   804  to write files anywhere. By specifying the **--read-only** flag, the container will have
   805  its root filesystem mounted as read only prohibiting any writes.
   806  
   807  #### **--read-only-tmpfs**=**true**|**false**
   808  
   809  If container is running in **--read-only** mode, then mount a read-write tmpfs on _/run_, _/tmp_, and _/var/tmp_. The default is **true**.
   810  
   811  #### **--replace**=**true**|**false**
   812  
   813  If another container with the same name already exists, replace and remove it. The default is **false**.
   814  
   815  #### **--restart**=*policy*
   816  
   817  Restart policy to follow when containers exit.
   818  Restart policy will not take effect if a container is stopped via the **podman kill** or **podman stop** commands.
   819  
   820  Valid _policy_ values are:
   821  
   822  - `no`                       : Do not restart containers on exit
   823  - `on-failure[:max_retries]` : Restart containers when they exit with a non-zero exit code, retrying indefinitely or until the optional *max_retries* count is hit
   824  - `always`                   : Restart containers when they exit, regardless of status, retrying indefinitely
   825  - `unless-stopped`           : Identical to **always**
   826  
   827  Please note that restart will not restart containers after a system reboot.
   828  If this functionality is required in your environment, you can invoke Podman from a **systemd.unit**(5) file, or create an init script for whichever init system is in use.
   829  To generate systemd unit files, please see **podman generate systemd**.
   830  
   831  #### **--rm**=**true**|**false**
   832  
   833  Automatically remove the container when it exits. The default is **false**.
   834  
   835  Note that the container will not be removed when it could not be created or
   836  started successfully. This allows the user to inspect the container after
   837  failure.
   838  
   839  #### **--rmi**=*true|false*
   840  
   841  After exit of the container, remove the image unless another
   842  container is using it. The default is *false*.
   843  
   844  #### **--rootfs**
   845  
   846  If specified, the first argument refers to an exploded container on the file system.
   847  
   848  This is useful to run a container without requiring any image management, the rootfs
   849  of the container is assumed to be managed externally.
   850  
   851  Note: On **SELinux** systems, the rootfs needs the correct label, which is by default
   852  **unconfined_u:object_r:container_file_t**.
   853  
   854  #### **--sdnotify**=**container**|**conmon**|**ignore**
   855  
   856  Determines how to use the NOTIFY_SOCKET, as passed with systemd and Type=notify.
   857  
   858  Default is **container**, which means allow the OCI runtime to proxy the socket into the
   859  container to receive ready notification. Podman will set the MAINPID to conmon's pid.
   860  The **conmon** option sets MAINPID to conmon's pid, and sends READY when the container
   861  has started. The socket is never passed to the runtime or the container.
   862  The **ignore** option removes NOTIFY_SOCKET from the environment for itself and child processes,
   863  for the case where some other process above Podman uses NOTIFY_SOCKET and Podman should not use it.
   864  
   865  #### **--seccomp-policy**=*policy*
   866  
   867  Specify the policy to select the seccomp profile. If set to *image*, Podman will look for a "io.podman.seccomp.profile" label in the container-image config and use its value as a seccomp profile. Otherwise, Podman will follow the *default* policy by applying the default profile unless specified otherwise via *--security-opt seccomp* as described below.
   868  
   869  Note that this feature is experimental and may change in the future.
   870  
   871  #### **--security-opt**=*option*
   872  
   873  Security Options
   874  
   875  - **apparmor=unconfined** : Turn off apparmor confinement for the container
   876  - **apparmor**=_your-profile_ : Set the apparmor confinement profile for the container
   877  - **label=user:**_USER_: Set the label user for the container processes
   878  - **label=role:**_ROLE_: Set the label role for the container processes
   879  - **label=type:**_TYPE_: Set the label process type for the container processes
   880  - **label=level:**_LEVEL_: Set the label level for the container processes
   881  - **label=filetype:**TYPE_: Set the label file type for the container files
   882  - **label=disable**: Turn off label separation for the container
   883  - **no-new-privileges**: Disable container processes from gaining additional privileges
   884  - **seccomp=unconfined**: Turn off seccomp confinement for the container
   885  - **seccomp**=_profile.json_: Allowed syscall list seccomp JSON file to be used as a seccomp filter
   886  - **proc-opts**=_OPTIONS_ : Comma separated list of options to use for the /proc mount. More details
   887    for the possible mount options are specified at **proc(5)** man page.
   888  
   889  Note: Labeling can be disabled for all containers by setting **label=false** in the **containers.conf**(5) file.
   890  
   891  #### **--shm-size**=_number_[_unit_]
   892  
   893  Size of _/dev/shm_. A _unit_ can be **b** (bytes), **k** (kilobytes), **m** (megabytes), or **g** (gigabytes).
   894  If you omit the unit, the system uses bytes. If you omit the size entirely, the default is **64m**.
   895  When _size_ is **0**, there is no limit on the amount of memory used for IPC by the container.
   896  
   897  #### **--sig-proxy**=**true**|**false**
   898  
   899  Sets whether the signals sent to the **podman run** command are proxied to the container process. SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is **true**.
   900  
   901  #### **--stop-signal**=*signal*
   902  
   903  Signal to stop a container. Default is **SIGTERM**.
   904  
   905  #### **--stop-timeout**=*seconds*
   906  
   907  Timeout to stop a container. Default is **10**.
   908  Remote connections use local containers.conf for defaults
   909  
   910  #### **--subgidname**=*name*
   911  
   912  Run the container in a new user namespace using the map with _name_ in the _/etc/subgid_ file.
   913  If calling **podman run** as an unprivileged user, the user needs to have the right to use the mapping. See **subgid**(5).
   914  This flag conflicts with **--userns** and **--gidmap**.
   915  
   916  #### **--subuidname**=*name*
   917  
   918  Run the container in a new user namespace using the map with _name_ in the _/etc/subuid_ file.
   919  If calling **podman run** as an unprivileged user, the user needs to have the right to use the mapping. See **subuid**(5).
   920  This flag conflicts with **--userns** and **--uidmap**.
   921  
   922  #### **--sysctl**=_name_=_value_
   923  
   924  Configure namespaced kernel parameters at runtime.
   925  
   926  For the IPC namespace, the following sysctls are allowed:
   927  
   928  - kernel.msgmax
   929  - kernel.msgmnb
   930  - kernel.msgmni
   931  - kernel.sem
   932  - kernel.shmall
   933  - kernel.shmmax
   934  - kernel.shmmni
   935  - kernel.shm_rmid_forced
   936  - Sysctls beginning with fs.mqueue.\*
   937  
   938  Note: if you use the **--ipc=host** option, the above sysctls will not be allowed.
   939  
   940  For the network namespace, the following ysctls areallowed:
   941  
   942  - Sysctls beginning with net.\*
   943  
   944  Note: if you use the **--network=host** option, these sysctls will not be allowed.
   945  
   946  #### **--systemd**=**true**|**false**|**always**
   947  
   948  Run container in systemd mode. The default is **true**.
   949  
   950  The value *always* enforces the systemd mode is enforced without
   951  looking at the executable name. Otherwise, if set to **true** and the
   952  command you are running inside the container is systemd, _/usr/sbin/init_,
   953  _/sbin/init_ or _/usr/local/sbin/init_.
   954  
   955  If the command you are running inside of the container is systemd
   956  Podman will setup tmpfs mount points in the following directories:
   957  
   958  - _/run_
   959  - _/run/lock_
   960  - _/tmp_
   961  - _/sys/fs/cgroup/systemd_
   962  - _/var/lib/journal_
   963  
   964  It will also set the default stop signal to **SIGRTMIN+3**.
   965  
   966  This allows systemd to run in a confined container without any modifications.
   967  
   968  Note that on **SELinux** systems, systemd attempts to write to the cgroup
   969  file system. Containers writing to the cgroup file system are denied by default.
   970  The **container_manage_cgroup** boolean must be enabled for this to be allowed on an SELinux separated system.
   971  ```
   972  setsebool -P container_manage_cgroup true
   973  ```
   974  
   975  #### **--tmpfs**=*fs*
   976  
   977  Create a tmpfs mount.
   978  
   979  Mount a temporary filesystem (**tmpfs**) mount into a container, for example:
   980  
   981  ```
   982  $ podman run -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image
   983  ```
   984  
   985  This command mounts a **tmpfs** at _/tmp_ within the container. The supported mount
   986  options are the same as the Linux default mount flags. If you do not specify
   987  any options, the systems uses the following options:
   988  **rw,noexec,nosuid,nodev**.
   989  
   990  #### **--tty**, **-t**=**true**|**false**
   991  
   992  Allocate a pseudo-TTY. The default is **false**.
   993  
   994  When set to **true**, Podman will allocate a pseudo-tty and attach to the standard
   995  input of the container. This can be used, for example, to run a throwaway
   996  interactive shell. The default is **false**.
   997  
   998  **NOTE**: The **-t** option is incompatible with a redirection of the Podman client
   999  standard input.
  1000  
  1001  #### **--tz**=*timezone*
  1002  
  1003  Set timezone in container. This flag takes area-based timezones, GMT time, as well as `local`, which sets the timezone in the container to match the host machine. See `/usr/share/zoneinfo/` for valid timezones.
  1004  Remote connections use local containers.conf for defaults
  1005  
  1006  #### **--umask**=*umask*
  1007  
  1008  Set the umask inside the container. Defaults to `0022`.
  1009  Remote connections use local containers.conf for defaults
  1010  
  1011  #### **--uidmap**=*container_uid*:*host_uid*:*amount*
  1012  
  1013  Run the container in a new user namespace using the supplied mapping. This option conflicts
  1014  with the **--userns** and **--subuidname** flags.
  1015  This option can be passed several times to map different ranges. If calling **podman run**
  1016  as an unprivileged user, the user needs to have the right to use the mapping. See **subuid**(5).
  1017  
  1018  The following example maps uids 0-1999 in the container to the uids 30000-31999 on the host: **--uidmap=0:30000:2000**.
  1019  
  1020  #### **--ulimit**=*option*
  1021  
  1022  Ulimit options. You can use **host** to copy the current configuration from the host.
  1023  
  1024  #### **--user**, **-u**=[_user_ | _user_:_group_ | _uid_ | _uid_:_gid_ | _user_:_gid_ | _uid_:_group_ ]
  1025  
  1026  Sets the username or UID used and optionally the groupname or GID for the specified command.
  1027  
  1028  Without this argument, the command will run as the user specified in the container image. Unless overridden by a `USER` command in the Containerfile or by a value passed to this option, this user generally defaults to root.
  1029  
  1030  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.
  1031  
  1032  #### **--userns**=**auto**|**host**|**keep-id**|**container:**_id_|**ns:**_namespace_
  1033  
  1034  Set the user namespace mode for the container. It defaults to the **PODMAN_USERNS** environment variable. An empty value ("") means user namespaces are disabled unless an explicit mapping is set with they `--uidmapping` and `--gidmapping` options.
  1035  
  1036  - **auto**: automatically create a namespace. It is possible to specify other options to `auto`. The supported options are
  1037    **size=SIZE** to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will guess a size for the user namespace.
  1038    **uidmapping=HOST_UID:CONTAINER_UID:SIZE** to force a UID mapping to be present in the user namespace.
  1039    **gidmapping=HOST_UID:CONTAINER_UID:SIZE** to force a GID mapping to be present in the user namespace.
  1040  - **host**: 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).
  1041  - **keep-id**: creates a user namespace where the current rootless user's UID:GID are mapped to the same values in the container. This option is ignored for containers created by the root user.
  1042  - **ns**: run the container in the given existing user namespace.
  1043  - **private**: create a new namespace for the container.
  1044  - **container**: join the user namespace of the specified container.
  1045  
  1046  This option is incompatible with **--gidmap**, **--uidmap**, **--subuidname** and **--subgidname**.
  1047  
  1048  #### **--uts**=*mode*
  1049  
  1050  Set the UTS namespace mode for the container. The following values are supported:
  1051  
  1052  - **host**: use the host's UTS namespace inside the container.
  1053  - **private**: create a new namespace for the container (default).
  1054  - **ns:[path]**: run the container in the given existing UTS namespace.
  1055  - **container:[container]**: join the UTS namespace of the specified container.
  1056  
  1057  #### **--volume**, **-v**[=[[_source-volume_|_host-dir_:]_container-dir_[:_options_]]]
  1058  
  1059  Create a bind mount. If you specify _/host-dir_:_/container-dir_, Podman
  1060  bind mounts _host-dir_ in the host to _container-dir_ in the Podman
  1061  container. Similarly, _source-volume_:_/container-dir_ will mount the volume
  1062  in the host to the container. If no such named volume exists, Podman will
  1063  create one.
  1064  
  1065  The _options_ is a comma delimited list and can be: <sup>[[1]](#Footnote1)</sup>
  1066  
  1067  * **rw**|**ro**
  1068  * **z**|**Z**
  1069  * [**r**]**shared**|[**r**]**slave**|[**r**]**private**[**r**]**unbindable**
  1070  * [**r**]**bind**
  1071  * [**no**]**exec**
  1072  * [**no**]**dev**
  1073  * [**no**]**suid**
  1074  * [**O**]
  1075  
  1076  The _container-dir_ must be an absolute path.
  1077  
  1078  Volumes may specify a source as well, as either a directory on the host or the
  1079  name of a named volume. If no source is given, the volume will be created as an
  1080  anonymous named volume with a randomly generated name, and will be removed when
  1081  the container is removed via the **--rm** flag or **podman rm --volumes**.
  1082  
  1083  If a volume source is specified, it must be a path on the host or the name of a
  1084  named volume. Host paths are allowed to be absolute or relative; relative paths
  1085  are resolved relative to the directory Podman is run in. Any source that does
  1086  not begin with a **.** or **/** will be treated as the name of a named volume.
  1087  If a volume with that name does not exist, it will be created. Volumes created
  1088  with names are not anonymous and are not removed by **--rm** and
  1089  **podman rm --volumes**.
  1090  
  1091  You can specify multiple **-v** options to mount one or more volumes into a
  1092  container.
  1093  
  1094  You can add **:ro** or **:rw** option to mount a volume in read-only or
  1095  read-write mode, respectively. By default, the volumes are mounted read-write.
  1096  
  1097    `Labeling Volume Mounts`
  1098  
  1099  Labeling systems like SELinux require that proper labels are placed on volume
  1100  content mounted into a container. Without a label, the security system might
  1101  prevent the processes running inside the container from using the content. By
  1102  default, Podman does not change the labels set by the OS.
  1103  
  1104  To change a label in the container context, you can add either of two suffixes
  1105  **:z** or **:Z** to the volume mount. These suffixes tell Podman to relabel file
  1106  objects on the shared volumes. The **z** option tells Podman that two containers
  1107  share the volume content. As a result, Podman labels the content with a shared
  1108  content label. Shared volume labels allow all containers to read/write content.
  1109  The **Z** option tells Podman to label the content with a private unshared label.
  1110  
  1111    `Overlay Volume Mounts`
  1112  
  1113     The `:O` flag tells Podman to mount the directory from the host as a
  1114  temporary storage using the `overlay file system`. The container processes
  1115  can modify content within the mountpoint which is stored in the
  1116  container storage in a separate directory. In overlay terms, the source
  1117  directory will be the lower, and the container storage directory will be the
  1118  upper. Modifications to the mount point are destroyed when the container
  1119  finishes executing, similar to a tmpfs mount point being unmounted.
  1120  
  1121    Subsequent executions of the container will see the original source directory
  1122  content, any changes from previous container executions no longer exists.
  1123  
  1124    One use case of the overlay mount is sharing the package cache from the
  1125  host into the container to allow speeding up builds.
  1126  
  1127    Note:
  1128  
  1129       - The `O` flag conflicts with other options listed above.
  1130  Content mounted into the container is labeled with the private label.
  1131         On SELinux systems, labels in the source directory must be readable
  1132  by the container label. Usually containers can read/execute `container_share_t`
  1133  and can read/write `container_file_t`. If you can not change the labels on a
  1134  source volume, SELinux container separation must be disabled for the container
  1135  to work.
  1136       - The source directory mounted into the container with an overlay mount
  1137  should not be modified, it can cause unexpected failures. It is recommended
  1138  that you do not modify the directory until the container finishes running.
  1139  
  1140  Only the current container can use a private volume.
  1141  
  1142    `Mounts propagation`
  1143  
  1144  By default bind mounted volumes are `private`. That means any mounts done
  1145  inside container will not be visible on host and vice versa. One can change
  1146  this behavior by specifying a volume mount propagation property. Making a
  1147  volume shared mounts done under that volume inside container will be
  1148  visible on host and vice versa. Making a volume **slave** enables only one
  1149  way mount propagation and that is mounts done on host under that volume
  1150  will be visible inside container but not the other way around. <sup>[[1]](#Footnote1)</sup>
  1151  
  1152  To control mount propagation property of volume one can use [**r**]**shared**,
  1153  [**r**]**slave**, [**r**]**private** or [**r**]**unbindable** propagation flag.
  1154  Propagation property can be specified only for bind mounted volumes and not for
  1155  internal volumes or named volumes. For mount propagation to work source mount
  1156  point (mount point where source dir is mounted on) has to have right propagation
  1157  properties. For shared volumes, source mount point has to be shared. And for
  1158  slave volumes, source mount has to be either shared or slave.
  1159  <sup>[[1]](#Footnote1)</sup>
  1160  
  1161  If you want to recursively mount a volume and all of its submounts into a
  1162  container, then you can use the **rbind** option. By default the bind option is
  1163  used, and submounts of the source directory will not be mounted into the
  1164  container.
  1165  
  1166  Mounting the volume with the **nosuid** options means that SUID applications on
  1167  the volume will not be able to change their privilege. By default volumes
  1168  are mounted with **nosuid**.
  1169  
  1170  Mounting the volume with the **noexec** option means that no executables on the
  1171  volume will be able to executed within the container.
  1172  
  1173  Mounting the volume with the **nodev** option means that no devices on the volume
  1174  will be able to be used by processes within the container. By default volumes
  1175  are mounted with **nodev**.
  1176  
  1177  If the _host-dir_ is a mount point, then **dev**, **suid**, and **exec** options are
  1178  ignored by the kernel.
  1179  
  1180  Use **df $hostdir** to figure out the source mount, and then use
  1181  **findmnt -o TARGET,PROPAGATION _source-mount-dir_** to figure out propagation
  1182  properties of source mount. If **findmnt**(1) utility is not available, then one
  1183  can look at mount entry for source mount point in _/proc/self/mountinfo_. Look
  1184  at the "optional fields" and see if any propagation properties are specified.
  1185  In there, **shared:N** means the mount is shared, **master:N** means mount
  1186  is slave, and if nothing is there, the mount is private. <sup>[[1]](#Footnote1)</sup>
  1187  
  1188  To change propagation properties of a mount point, use **mount**(8) command. For
  1189  example, if one wants to bind mount source directory _/foo_, one can do
  1190  **mount --bind /foo /foo** and **mount --make-private --make-shared /foo**. This
  1191  will convert /foo into a shared mount point. Alternatively, one can directly
  1192  change propagation properties of source mount. Say, if _/_ is source mount for
  1193  _/foo_, then use **mount --make-shared /** to convert _/_ into a shared mount.
  1194  
  1195  #### **--volumes-from**[=*CONTAINER*[:*OPTIONS*]]
  1196  
  1197  Mount volumes from the specified container(s). Used to share volumes between
  1198  containers. The *options* is a comma delimited list with the following available elements:
  1199  
  1200  * **rw**|**ro**
  1201  * **z**
  1202  
  1203  Mounts already mounted volumes from a source container onto another
  1204  container. You must supply the source's container-id or container-name.
  1205  To share a volume, use the --volumes-from option when running
  1206  the target container. You can share volumes even if the source container
  1207  is not running.
  1208  
  1209  By default, Podman mounts the volumes in the same mode (read-write or
  1210  read-only) as it is mounted in the source container.
  1211  You can change this by adding a `ro` or `rw` _option_.
  1212  
  1213  Labeling systems like SELinux require that proper labels are placed on volume
  1214  content mounted into a container. Without a label, the security system might
  1215  prevent the processes running inside the container from using the content. By
  1216  default, Podman does not change the labels set by the OS.
  1217  
  1218  To change a label in the container context, you can add `z` to the volume mount.
  1219  This suffix tells Podman to relabel file objects on the shared volumes. The `z`
  1220  option tells Podman that two containers share the volume content. As a result,
  1221  Podman labels the content with a shared content label. Shared volume labels allow
  1222  all containers to read/write content.
  1223  
  1224  If the location of the volume from the source container overlaps with
  1225  data residing on a target container, then the volume hides
  1226  that data on the target.
  1227  
  1228  #### **--workdir**, **-w**=*dir*
  1229  
  1230  Working directory inside the container.
  1231  
  1232  The default working directory for running binaries within a container is the root directory (**/**).
  1233  The image developer can set a different default with the WORKDIR instruction. The operator
  1234  can override the working directory by using the **-w** option.
  1235  
  1236  ## Exit Status
  1237  
  1238  The exit code from **podman run** gives information about why the container
  1239  failed to run or why it exited. When **podman run** exits with a non-zero code,
  1240  the exit codes follow the **chroot**(1) standard, see below:
  1241  
  1242    **125** The error is with Podman itself
  1243  
  1244      $ podman run --foo busybox; echo $?
  1245      Error: unknown flag: --foo
  1246      125
  1247  
  1248    **126** The _contained command_ cannot be invoked
  1249  
  1250      $ podman run busybox /etc; echo $?
  1251      Error: container_linux.go:346: starting container process caused "exec: \"/etc\": permission denied": OCI runtime error
  1252      126
  1253  
  1254    **127** The _contained command_ cannot be found
  1255  
  1256      $ podman run busybox foo; echo $?
  1257      Error: container_linux.go:346: starting container process caused "exec: \"foo\": executable file not found in $PATH": OCI runtime error
  1258      127
  1259  
  1260    **Exit code** _contained command_ exit code
  1261  
  1262      $ podman run busybox /bin/sh -c 'exit 3'; echo $?
  1263      3
  1264  
  1265  ## EXAMPLES
  1266  
  1267  ### Running container in read-only mode
  1268  
  1269  During container image development, containers often need to write to the image
  1270  content. Installing packages into _/usr_, for example. In production,
  1271  applications seldom need to write to the image.  Container applications write
  1272  to volumes if they need to write to file systems at all. Applications can be
  1273  made more secure by running them in read-only mode using the **--read-only** switch.
  1274  This protects the containers image from modification. Read only containers may
  1275  still need to write temporary data. The best way to handle this is to mount
  1276  tmpfs directories on _/run_ and _/tmp_.
  1277  
  1278  ```
  1279  $ podman run --read-only -i -t fedora /bin/bash
  1280  
  1281  $ podman run --read-only --read-only-tmpfs=false --tmpfs /run -i -t fedora /bin/bash
  1282  ```
  1283  
  1284  ### Exposing log messages from the container to the host's log
  1285  
  1286  If you want messages that are logged in your container to show up in the host's
  1287  syslog/journal then you should bind mount the _/dev/log_ directory as follows.
  1288  
  1289  ```
  1290  $ podman run -v /dev/log:/dev/log -i -t fedora /bin/bash
  1291  ```
  1292  
  1293  From inside the container you can test this by sending a message to the log.
  1294  
  1295  ```
  1296  (bash)# logger "Hello from my container"
  1297  ```
  1298  
  1299  Then exit and check the journal.
  1300  
  1301  ```
  1302  (bash)# exit
  1303  
  1304  $ journalctl -b | grep Hello
  1305  ```
  1306  
  1307  This should list the message sent to logger.
  1308  
  1309  ### Attaching to one or more from STDIN, STDOUT, STDERR
  1310  
  1311  If you do not specify **-a**, Podman will attach everything (stdin, stdout, stderr).
  1312  You can specify to which of the three standard streams (stdin, stdout, stderr)
  1313  you'd like to connect instead, as in:
  1314  
  1315  ```
  1316  $ podman run -a stdin -a stdout -i -t fedora /bin/bash
  1317  ```
  1318  
  1319  ### Sharing IPC between containers
  1320  
  1321  Using **shm_server.c** available here: https://www.cs.cf.ac.uk/Dave/C/node27.html
  1322  
  1323  Testing **--ipc=host** mode:
  1324  
  1325  Host shows a shared memory segment with 7 pids attached, happens to be from httpd:
  1326  
  1327  ```
  1328  $ sudo ipcs -m
  1329  
  1330  ------ Shared Memory Segments --------
  1331  key        shmid      owner      perms      bytes      nattch     status
  1332  0x01128e25 0          root       600        1000       7
  1333  ```
  1334  
  1335  Now run a regular container, and it correctly does NOT see the shared memory segment from the host:
  1336  
  1337  ```
  1338  $ podman run -it shm ipcs -m
  1339  
  1340  ------ Shared Memory Segments --------
  1341  key        shmid      owner      perms      bytes      nattch     status
  1342  ```
  1343  
  1344  Run a container with the new **--ipc=host** option, and it now sees the shared memory segment from the host httpd:
  1345  
  1346  ```
  1347  $ podman run -it --ipc=host shm ipcs -m
  1348  
  1349  ------ Shared Memory Segments --------
  1350  key        shmid      owner      perms      bytes      nattch     status
  1351  0x01128e25 0          root       600        1000       7
  1352  ```
  1353  Testing **--ipc=container:**_id_ mode:
  1354  
  1355  Start a container with a program to create a shared memory segment:
  1356  ```
  1357  $ podman run -it shm bash
  1358  $ sudo shm/shm_server &
  1359  $ sudo ipcs -m
  1360  
  1361  ------ Shared Memory Segments --------
  1362  key        shmid      owner      perms      bytes      nattch     status
  1363  0x0000162e 0          root       666        27         1
  1364  ```
  1365  Create a 2nd container correctly shows no shared memory segment from 1st container:
  1366  ```
  1367  $ podman run shm ipcs -m
  1368  
  1369  ------ Shared Memory Segments --------
  1370  key        shmid      owner      perms      bytes      nattch     status
  1371  ```
  1372  
  1373  Create a 3rd container using the **--ipc=container:**_id_ option, now it shows the shared memory segment from the first:
  1374  
  1375  ```
  1376  $ podman run -it --ipc=container:ed735b2264ac shm ipcs -m
  1377  $ sudo ipcs -m
  1378  
  1379  ------ Shared Memory Segments --------
  1380  key        shmid      owner      perms      bytes      nattch     status
  1381  0x0000162e 0          root       666        27         1
  1382  ```
  1383  
  1384  ### Mapping Ports for External Usage
  1385  
  1386  The exposed port of an application can be mapped to a host port using the **-p**
  1387  flag. For example, an httpd port 80 can be mapped to the host port 8080 using the
  1388  following:
  1389  
  1390  ```
  1391  $ podman run -p 8080:80 -d -i -t fedora/httpd
  1392  ```
  1393  
  1394  ### Mounting External Volumes
  1395  
  1396  To mount a host directory as a container volume, specify the absolute path to
  1397  the directory and the absolute path for the container directory separated by a
  1398  colon. If the source is a named volume maintained by Podman, it is recommended to
  1399  use its name rather than the path to the volume. Otherwise the volume will be
  1400  considered as an orphan and wiped if you execute **podman volume prune**:
  1401  
  1402  ```
  1403  $ podman run -v /var/db:/data1 -i -t fedora bash
  1404  
  1405  $ podman run -v data:/data2 -i -t fedora bash
  1406  
  1407  $ podman run -v /var/cache/dnf:/var/cache/dnf:O -ti fedora dnf -y update
  1408  ```
  1409  
  1410  Using **--mount** flags to mount a host directory as a container folder, specify
  1411  the absolute path to the directory or the volume name, and the absolute path
  1412  within the container directory:
  1413  
  1414  ````
  1415  $ podman run --mount type=bind,src=/var/db,target=/data1 busybox sh
  1416  
  1417  $ podman run --mount type=bind,src=volume-name,target=/data1 busybox sh
  1418  ````
  1419  
  1420  When using SELinux, be aware that the host has no knowledge of container SELinux
  1421  policy. Therefore, in the above example, if SELinux policy is enforced, the
  1422  _/var/db_ directory is not writable to the container. A "Permission Denied"
  1423  message will occur and an **avc:** message in the host's syslog.
  1424  
  1425  To work around this, at time of writing this man page, the following command
  1426  needs to be run in order for the proper SELinux policy type label to be attached
  1427  to the host directory:
  1428  
  1429  ```
  1430  $ chcon -Rt svirt_sandbox_file_t /var/db
  1431  ```
  1432  
  1433  Now, writing to the _/data1_ volume in the container will be allowed and the
  1434  changes will also be reflected on the host in _/var/db_.
  1435  
  1436  ### Using alternative security labeling
  1437  
  1438  You can override the default labeling scheme for each container by specifying
  1439  the **--security-opt** flag. For example, you can specify the MCS/MLS level, a
  1440  requirement for MLS systems. Specifying the level in the following command
  1441  allows you to share the same content between containers.
  1442  
  1443  ```
  1444  podman run --security-opt label=level:s0:c100,c200 -i -t fedora bash
  1445  ```
  1446  
  1447  An MLS example might be:
  1448  
  1449  ```
  1450  $ podman run --security-opt label=level:TopSecret -i -t rhel7 bash
  1451  ```
  1452  
  1453  To disable the security labeling for this container versus running with the
  1454  #### **--permissive** flag, use the following command:
  1455  
  1456  ```
  1457  $ podman run --security-opt label=disable -i -t fedora bash
  1458  ```
  1459  
  1460  If you want a tighter security policy on the processes within a container,
  1461  you can specify an alternate type for the container. You could run a container
  1462  that is only allowed to listen on Apache ports by executing the following
  1463  command:
  1464  
  1465  ```
  1466  $ podman run --security-opt label=type:svirt_apache_t -i -t centos bash
  1467  ```
  1468  
  1469  Note you would have to write policy defining a **svirt_apache_t** type.
  1470  
  1471  ### Setting device weight
  1472  
  1473  If you want to set _/dev/sda_ device weight to **200**, you can specify the device
  1474  weight by **--blkio-weight-device** flag. Use the following command:
  1475  
  1476  ```
  1477  $ podman run -it --blkio-weight-device "/dev/sda:200" ubuntu
  1478  ```
  1479  
  1480  ### Setting Namespaced Kernel Parameters (Sysctls)
  1481  
  1482  The **--sysctl** sets namespaced kernel parameters (sysctls) in the
  1483  container. For example, to turn on IP forwarding in the containers
  1484  network namespace, run this command:
  1485  
  1486  ```
  1487  $ podman run --sysctl net.ipv4.ip_forward=1 someimage
  1488  ```
  1489  
  1490  Note that not all sysctls are namespaced. Podman does not support changing sysctls
  1491  inside of a container that also modify the host system. As the kernel
  1492  evolves we expect to see more sysctls become namespaced.
  1493  
  1494  See the definition of the **--sysctl** option above for the current list of
  1495  supported sysctls.
  1496  
  1497  ### Set UID/GID mapping in a new user namespace
  1498  
  1499  Running a container in a new user namespace requires a mapping of
  1500  the uids and gids from the host.
  1501  
  1502  ```
  1503  $ podman run --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
  1504  ```
  1505  
  1506  ### Configuring Storage Options from the command line
  1507  
  1508  Podman allows for the configuration of storage by changing the values
  1509  in the _/etc/container/storage.conf_ or by using global options. This
  1510  shows how to setup and use fuse-overlayfs for a one time run of busybox
  1511  using global options.
  1512  
  1513  ```
  1514  podman --log-level=debug --storage-driver overlay --storage-opt "overlay.mount_program=/usr/bin/fuse-overlayfs" run busybox /bin/sh
  1515  ```
  1516  
  1517  ### Configure timezone in a container
  1518  
  1519  ```
  1520  $ podman run --tz=local alpine date
  1521  $ podman run --tz=Asia/Shanghai alpine date
  1522  $ podman run --tz=US/Eastern alpine date
  1523  ```
  1524  
  1525  ### Rootless Containers
  1526  
  1527  Podman runs as a non root user on most systems. This feature requires that a new enough version of **shadow-utils**
  1528  be installed. The **shadow-utils** package must include the **newuidmap**(1) and **newgidmap**(1) executables.
  1529  
  1530  Note: RHEL7 and Centos 7 will not have this feature until RHEL7.7 is released.
  1531  
  1532  In order for users to run rootless, there must be an entry for their username in _/etc/subuid_ and _/etc/subgid_ which lists the UIDs for their user namespace.
  1533  
  1534  Rootless Podman works better if the fuse-overlayfs and slirp4netns packages are installed.
  1535  The **fuse-overlay** package provides a userspace overlay storage driver, otherwise users need to use
  1536  the **vfs** storage driver, which is diskspace expensive and does not perform well. slirp4netns is
  1537  required for VPN, without it containers need to be run with the **--network=host** flag.
  1538  
  1539  ## ENVIRONMENT
  1540  
  1541  Environment variables within containers can be set using multiple different options,
  1542  in the following order of precedence (later entries override earlier entries):
  1543  
  1544  - Container image: Any environment variables specified in the container image.
  1545  - **--http-proxy**: By default, several environment variables will be passed in from the host, such as **http_proxy** and **no_proxy**. See **--http-proxy** for details.
  1546  - **--env-host**: Host environment of the process executing Podman is added.
  1547  - **--env-file**: Any environment variables specified via env-files. If multiple files specified, then they override each other in order of entry.
  1548  - **--env**: Any environment variables specified will override previous settings.
  1549  
  1550  Run containers and set the environment ending with a __*__ and a __*****__:
  1551  
  1552  ```
  1553  $ export ENV1=a
  1554  $ podman run --env ENV* alpine printenv ENV1
  1555  a
  1556  
  1557  $ podman run --env ENV*****=b alpine printenv ENV*****
  1558  b
  1559  ```
  1560  
  1561  ## FILES
  1562  
  1563  **/etc/subuid**
  1564  
  1565  **/etc/subgid**
  1566  
  1567  NOTE: Use the environment variable `TMPDIR` to change the temporary storage location of downloaded container images. Podman defaults to use `/var/tmp`.
  1568  
  1569  ## SEE ALSO
  1570  **podman**(1), **podman-save**(1), **podman-ps**(1), **podman-attach**(1), **podman-pod-create**(1), **podman-port**(1), **podman-kill**(1), **podman-stop**(1),
  1571  **podman-generate-systemd**(1) **podman-rm**(1), **subgid**(5), **subuid**(5), **containers.conf**(5), **systemd.unit**(5), **setsebool**(8), **slirp4netns**(1), **fuse-overlayfs**(1), **proc**(5)**.
  1572  
  1573  ## HISTORY
  1574  September 2018, updated by Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
  1575  
  1576  October 2017, converted from Docker documentation to Podman by Dan Walsh for Podman <dwalsh@redhat.com>
  1577  
  1578  November 2015, updated by Sally O'Malley <somalley@redhat.com>
  1579  
  1580  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
  1581  
  1582  April 2014, Originally compiled by William Henry <whenry@redhat.com> based on docker.com source material and internal work.
  1583  
  1584  ## FOOTNOTES
  1585  <a name="Footnote1">1</a>: The Podman project is committed to inclusivity, a core value of open source. The `master` and `slave` 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.