github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/podman-run.1.md.in (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, a container environment
    30  file is created in each container to indicate to programs they are running in a
    31  container. This file is located at _/run/.containerenv_ (or
    32  _/var/run/.containerenv_ for FreeBSD containers). When using the
    33  --privileged flag the .containerenv contains name/value pairs indicating the
    34  container engine version, whether the engine is running in rootless mode, the
    35  container name and ID, as well as the image name and ID that the container is based on. Note: _/run/.containerenv_ will not be created when a volume is mounted on /run.
    36  
    37  When running from a user defined network namespace, the _/etc/netns/NSNAME/resolv.conf_
    38  will be used if it exists, otherwise _/etc/resolv.conf_ will be used.
    39  
    40  Default settings are defined in `containers.conf`. Most settings for remote
    41  connections use the servers containers.conf, except when documented in man
    42  pages.
    43  
    44  ## IMAGE
    45  
    46    The image is specified using transport:path format. If no transport is specified, the `docker` (container registry)
    47  transport is used by default. For remote Podman, including Mac and Windows (excluding WSL2) machines, `docker` is the only allowed transport.
    48  
    49    **dir:**_path_
    50    An existing local directory _path_ storing the manifest, layer tarballs and signatures as individual files. This
    51  is a non-standardized format, primarily useful for debugging or noninvasive container inspection.
    52  
    53      $ podman save --format docker-dir fedora -o /tmp/fedora
    54      $ podman run dir:/tmp/fedora echo hello
    55  
    56    **docker://**_docker-reference_ (Default)
    57    An image reference stored in a remote container image registry. Example: "quay.io/podman/stable:latest".
    58  The reference can include a path to a specific registry; if it does not, the
    59  registries listed in registries.conf are queried to find a matching image.
    60  By default, credentials from `podman login` (stored at
    61  $XDG_RUNTIME_DIR/containers/auth.json by default) are used to authenticate;
    62  otherwise it falls back to using credentials in $HOME/.docker/config.json.
    63  
    64      $ podman run registry.fedoraproject.org/fedora:latest echo hello
    65  
    66    **docker-archive:**_path_[**:**_docker-reference_]
    67  An image stored in the `docker save` formatted file. _docker-reference_ is only used when creating such a
    68  file, and it must not contain a digest.
    69  
    70      $ podman save --format docker-archive fedora -o /tmp/fedora
    71      $ podman run docker-archive:/tmp/fedora echo hello
    72  
    73    **docker-daemon:**_docker-reference_
    74    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).
    75  
    76      $ sudo docker pull fedora
    77      $ sudo podman run docker-daemon:docker.io/library/fedora echo hello
    78  
    79    **oci-archive:**_path_**:**_tag_
    80    An image in a directory compliant with the "Open Container Image Layout Specification" at the specified _path_
    81  and specified with a _tag_.
    82  
    83      $ podman save --format oci-archive fedora -o /tmp/fedora
    84      $ podman run oci-archive:/tmp/fedora echo hello
    85  
    86  ## OPTIONS
    87  @@option add-host
    88  
    89  @@option annotation.container
    90  
    91  @@option arch
    92  
    93  @@option attach
    94  
    95  @@option authfile
    96  
    97  @@option blkio-weight
    98  
    99  @@option blkio-weight-device
   100  
   101  @@option cap-add
   102  
   103  @@option cap-drop
   104  
   105  @@option cgroup-conf
   106  
   107  @@option cgroup-parent
   108  
   109  @@option cgroupns
   110  
   111  @@option cgroups
   112  
   113  @@option chrootdirs
   114  
   115  @@option cidfile.write
   116  
   117  @@option conmon-pidfile
   118  
   119  @@option cpu-period
   120  
   121  @@option cpu-quota
   122  
   123  @@option cpu-rt-period
   124  
   125  @@option cpu-rt-runtime
   126  
   127  @@option cpu-shares
   128  
   129  @@option cpus.container
   130  
   131  @@option cpuset-cpus
   132  
   133  @@option cpuset-mems
   134  
   135  @@option decryption-key
   136  
   137  #### **--detach**, **-d**
   138  
   139  Detached mode: run the container in the background and print the new container ID. The default is *false*.
   140  
   141  At any time run **podman ps** in
   142  the other shell to view a list of the running containers. Reattach to a
   143  detached container with **podman attach** command.
   144  
   145  When attached via tty mode, detach from the container (and leave it
   146  running) using a configurable key sequence. The default sequence is `ctrl-p,ctrl-q`.
   147  Specify the key sequence using the **--detach-keys** option, or configure
   148  it in the **containers.conf** file: see **containers.conf(5)** for more information.
   149  
   150  @@option detach-keys
   151  
   152  @@option device
   153  
   154  Note: if the user only has access rights via a group, accessing the device
   155  from inside a rootless container fails. Use the `--group-add keep-groups`
   156  flag to pass the user's supplementary group access into the container.
   157  
   158  @@option device-cgroup-rule
   159  
   160  @@option device-read-bps
   161  
   162  @@option device-read-iops
   163  
   164  @@option device-write-bps
   165  
   166  @@option device-write-iops
   167  
   168  @@option disable-content-trust
   169  
   170  @@option dns
   171  
   172  This option cannot be combined with **--network** that is set to **none** or **container:**_id_.
   173  
   174  @@option dns-option.container
   175  
   176  @@option dns-search.container
   177  
   178  @@option entrypoint
   179  
   180  @@option env
   181  
   182  See [**Environment**](#environment) note below for precedence and examples.
   183  
   184  @@option env-file
   185  
   186  See [**Environment**](#environment) note below for precedence and examples.
   187  
   188  @@option env-host
   189  
   190  @@option env-merge
   191  
   192  @@option expose
   193  
   194  @@option gidmap.container
   195  
   196  @@option gpus
   197  
   198  @@option group-add
   199  
   200  @@option group-entry
   201  
   202  @@option health-cmd
   203  
   204  @@option health-interval
   205  
   206  @@option health-on-failure
   207  
   208  @@option health-retries
   209  
   210  @@option health-start-period
   211  
   212  @@option health-startup-cmd
   213  
   214  @@option health-startup-interval
   215  
   216  @@option health-startup-retries
   217  
   218  @@option health-startup-success
   219  
   220  @@option health-startup-timeout
   221  
   222  @@option health-timeout
   223  
   224  #### **--help**
   225  
   226  Print usage statement
   227  
   228  @@option hostname.container
   229  
   230  @@option hostuser
   231  
   232  @@option http-proxy
   233  
   234  @@option image-volume
   235  
   236  @@option init
   237  
   238  @@option init-path
   239  
   240  @@option interactive
   241  
   242  @@option ip
   243  
   244  @@option ip6
   245  
   246  @@option ipc
   247  
   248  @@option label
   249  
   250  @@option label-file
   251  
   252  @@option link-local-ip
   253  
   254  @@option log-driver
   255  
   256  @@option log-opt
   257  
   258  @@option mac-address
   259  
   260  @@option memory
   261  
   262  @@option memory-reservation
   263  
   264  @@option memory-swap
   265  
   266  @@option memory-swappiness
   267  
   268  @@option mount
   269  
   270  @@option name.container
   271  
   272  @@option network
   273  
   274  Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--network** set to **none** or **container:**_id_.
   275  
   276  If used together with **--pod**, the container joins the pod's network namespace.
   277  
   278  @@option network-alias
   279  
   280  @@option no-healthcheck
   281  
   282  @@option no-hosts
   283  
   284  This option conflicts with **--add-host**.
   285  
   286  @@option oom-kill-disable
   287  
   288  @@option oom-score-adj
   289  
   290  @@option os.pull
   291  
   292  #### **--passwd**
   293  
   294  Allow Podman to add entries to /etc/passwd and /etc/group when used in conjunction with the --user option.
   295  This is used to override the Podman provided user setup in favor of entrypoint configurations such as libnss-extrausers.
   296  
   297  @@option passwd-entry
   298  
   299  @@option personality
   300  
   301  @@option pid.container
   302  
   303  @@option pidfile
   304  
   305  @@option pids-limit
   306  
   307  @@option platform
   308  
   309  @@option pod.run
   310  
   311  @@option pod-id-file.container
   312  
   313  @@option preserve-fd
   314  
   315  @@option preserve-fds
   316  
   317  @@option privileged
   318  
   319  @@option publish
   320  
   321  **Note:** If a container runs within a pod, it is not necessary to publish the port for
   322  the containers in the pod. The port must only be published by the pod itself. Pod network
   323  stacks act like the network stack on the host - meaning a variety of containers in the pod
   324  and programs in the container all share a single interface, IP address, and
   325  associated ports. If one container binds to a port, no other container can use that port
   326  within the pod while it is in use. Containers in the pod can also communicate over localhost
   327  by having one container bind to localhost in the pod, and another connect to that port.
   328  
   329  @@option publish-all
   330  
   331  @@option pull
   332  
   333  #### **--quiet**, **-q**
   334  
   335  Suppress output information when pulling images
   336  
   337  @@option rdt-class
   338  
   339  @@option read-only
   340  
   341  @@option read-only-tmpfs
   342  
   343  @@option replace
   344  
   345  @@option requires
   346  
   347  @@option restart
   348  
   349  @@option retry
   350  
   351  @@option retry-delay
   352  
   353  #### **--rm**
   354  
   355  Automatically remove the container and any anonymous unnamed volume associated with
   356  the container when it exits. The default is **false**.
   357  
   358  #### **--rmi**
   359  
   360  After exit of the container, remove the image unless another
   361  container is using it. Implies --rm on the new container. The default is *false*.
   362  
   363  @@option rootfs
   364  
   365  @@option sdnotify
   366  
   367  @@option seccomp-policy
   368  
   369  @@option secret
   370  
   371  @@option security-opt
   372  
   373  @@option shm-size
   374  
   375  @@option shm-size-systemd
   376  
   377  @@option sig-proxy
   378  
   379  The default is **true**.
   380  
   381  @@option stop-signal
   382  
   383  @@option stop-timeout
   384  
   385  @@option subgidname
   386  
   387  @@option subuidname
   388  
   389  @@option sysctl
   390  
   391  @@option systemd
   392  
   393  @@option timeout
   394  
   395  @@option tls-verify
   396  
   397  @@option tmpfs
   398  
   399  @@option tty
   400  
   401  ```
   402  echo "asdf" | podman run --rm -i someimage /bin/cat
   403  ```
   404  
   405  @@option tz
   406  
   407  @@option uidmap.container
   408  
   409  @@option ulimit
   410  
   411  @@option umask
   412  
   413  @@option unsetenv
   414  
   415  @@option unsetenv-all
   416  
   417  @@option user
   418  
   419  @@option userns.container
   420  
   421  @@option uts.container
   422  
   423  @@option variant.container
   424  
   425  @@option volume
   426  
   427  Use the **--group-add keep-groups** option to pass the user's supplementary group access into the container.
   428  
   429  @@option volumes-from
   430  
   431  @@option workdir
   432  
   433  ## Exit Status
   434  
   435  The exit code from **podman run** gives information about why the container
   436  failed to run or why it exited. When **podman run** exits with a non-zero code,
   437  the exit codes follow the **chroot**(1) standard, see below:
   438  
   439    **125** The error is with Podman itself
   440  
   441      $ podman run --foo busybox; echo $?
   442      Error: unknown flag: --foo
   443      125
   444  
   445    **126** The _contained command_ cannot be invoked
   446  
   447      $ podman run busybox /etc; echo $?
   448      Error: container_linux.go:346: starting container process caused "exec: \"/etc\": permission denied": OCI runtime error
   449      126
   450  
   451    **127** The _contained command_ cannot be found
   452  
   453      $ podman run busybox foo; echo $?
   454      Error: container_linux.go:346: starting container process caused "exec: \"foo\": executable file not found in $PATH": OCI runtime error
   455      127
   456  
   457    **Exit code** _contained command_ exit code
   458  
   459      $ podman run busybox /bin/sh -c 'exit 3'; echo $?
   460      3
   461  
   462  ## EXAMPLES
   463  
   464  ### Running container in read-only mode
   465  
   466  During container image development, containers often need to write to the image
   467  content. Installing packages into _/usr_, for example. In production,
   468  applications seldom need to write to the image.  Container applications write
   469  to volumes if they need to write to file systems at all. Applications can be
   470  made more secure by running them in read-only mode using the **--read-only** switch.
   471  This protects the container's image from modification. By default read-only
   472  containers can write to temporary data. Podman mounts a tmpfs on _/run_ and
   473  _/tmp_ within the container.
   474  
   475  ```
   476  $ podman run --read-only -i -t fedora /bin/bash
   477  ```
   478  
   479  If the container does not write to any file
   480  system within the container, including tmpfs, set --read-only-tmpfs=false.
   481  ```
   482  $ podman run --read-only --read-only-tmpfs=false --tmpfs /run -i -t fedora /bin/bash
   483  ```
   484  
   485  ### Exposing shared libraries inside of container as read-only using a glob
   486  
   487  ```
   488  $ podman run --mount type=glob,src=/usr/lib64/libnvidia\*,ro=true -i -t fedora /bin/bash
   489  ```
   490  
   491  ### Exposing log messages from the container to the host's log
   492  
   493  Bind mount the _/dev/log_ directory to have messages that are logged in the container  show up in the host's
   494  syslog/journal.
   495  
   496  ```
   497  $ podman run -v /dev/log:/dev/log -i -t fedora /bin/bash
   498  ```
   499  
   500  From inside the container test this by sending a message to the log.
   501  
   502  ```
   503  (bash)# logger "Hello from my container"
   504  ```
   505  
   506  Then exit and check the journal.
   507  
   508  ```
   509  (bash)# exit
   510  
   511  $ journalctl -b | grep Hello
   512  ```
   513  
   514  This lists the message sent to the logger.
   515  
   516  ### Attaching to one or more from STDIN, STDOUT, STDERR
   517  
   518  Without specifying the **-a** option, Podman attaches everything (stdin, stdout, stderr).
   519  Override the default by specifying -a (stdin, stdout, stderr), as in:
   520  
   521  ```
   522  $ podman run -a stdin -a stdout -i -t fedora /bin/bash
   523  ```
   524  
   525  ### Sharing IPC between containers
   526  
   527  Using **shm_server.c** available here: https://www.cs.cf.ac.uk/Dave/C/node27.html
   528  
   529  Testing **--ipc=host** mode:
   530  
   531  Host shows a shared memory segment with 7 pids attached, happens to be from httpd:
   532  
   533  ```
   534  $ sudo ipcs -m
   535  
   536  ------ Shared Memory Segments --------
   537  key        shmid      owner      perms      bytes      nattch     status
   538  0x01128e25 0          root       600        1000       7
   539  ```
   540  
   541  Now run a regular container, and it correctly does NOT see the shared memory segment from the host:
   542  
   543  ```
   544  $ podman run -it shm ipcs -m
   545  
   546  ------ Shared Memory Segments --------
   547  key        shmid      owner      perms      bytes      nattch     status
   548  ```
   549  
   550  Run a container with the new **--ipc=host** option, and it now sees the shared memory segment from the host httpd:
   551  
   552  ```
   553  $ podman run -it --ipc=host shm ipcs -m
   554  
   555  ------ Shared Memory Segments --------
   556  key        shmid      owner      perms      bytes      nattch     status
   557  0x01128e25 0          root       600        1000       7
   558  ```
   559  Testing **--ipc=container:**_id_ mode:
   560  
   561  Start a container with a program to create a shared memory segment:
   562  ```
   563  $ podman run -it shm bash
   564  $ sudo shm/shm_server &
   565  $ sudo ipcs -m
   566  
   567  ------ Shared Memory Segments --------
   568  key        shmid      owner      perms      bytes      nattch     status
   569  0x0000162e 0          root       666        27         1
   570  ```
   571  Create a 2nd container correctly shows no shared memory segment from 1st container:
   572  ```
   573  $ podman run shm ipcs -m
   574  
   575  ------ Shared Memory Segments --------
   576  key        shmid      owner      perms      bytes      nattch     status
   577  ```
   578  
   579  Create a 3rd container using the **--ipc=container:**_id_ option, now it shows the shared memory segment from the first:
   580  
   581  ```
   582  $ podman run -it --ipc=container:ed735b2264ac shm ipcs -m
   583  $ sudo ipcs -m
   584  
   585  ------ Shared Memory Segments --------
   586  key        shmid      owner      perms      bytes      nattch     status
   587  0x0000162e 0          root       666        27         1
   588  ```
   589  
   590  ### Mapping Ports for External Usage
   591  
   592  The exposed port of an application can be mapped to a host port using the **-p**
   593  flag. For example, an httpd port 80 can be mapped to the host port 8080 using the
   594  following:
   595  
   596  ```
   597  $ podman run -p 8080:80 -d -i -t fedora/httpd
   598  ```
   599  
   600  ### Mounting External Volumes
   601  
   602  To mount a host directory as a container volume, specify the absolute path to
   603  the directory and the absolute path for the container directory separated by a
   604  colon. If the source is a named volume maintained by Podman, it is recommended to
   605  use its name rather than the path to the volume. Otherwise the volume is
   606  considered an orphan and wiped by the **podman volume prune** command:
   607  
   608  ```
   609  $ podman run -v /var/db:/data1 -i -t fedora bash
   610  
   611  $ podman run -v data:/data2 -i -t fedora bash
   612  
   613  $ podman run -v /var/cache/dnf:/var/cache/dnf:O -ti fedora dnf -y update
   614  ```
   615  
   616  If the container needs a writeable mounted volume by a non root user inside the container, use the **U** option. This option tells Podman to chown the source volume to match the default UID and GID used within the container.
   617  ```
   618  $ podman run -d -e MARIADB_ROOT_PASSWORD=root --user mysql --userns=keep-id -v ~/data:/var/lib/mysql:Z,U mariadb
   619  ```
   620  
   621  Alternatively if the container needs a writable volume by a non root
   622  user inside of the container, the --userns=keep-id option allows users to
   623  specify the UID and GID of the user executing Podman to specific UIDs and GIDs
   624  within the container. Since the processes running in the container run as the user's UID, they can read/write files owned by the user.
   625  ```
   626  $ podman run -d -e MARIADB_ROOT_PASSWORD=root --user mysql --userns=keep-id:uid=999,gid=999 -v ~/data:/var/lib/mysql:Z mariadb
   627  ```
   628  
   629  Using **--mount** flags to mount a host directory as a container folder, specify
   630  the absolute path to the directory or the volume name, and the absolute path
   631  within the container directory:
   632  
   633  ````
   634  $ podman run --mount type=bind,src=/var/db,target=/data1 busybox sh
   635  
   636  $ podman run --mount type=bind,src=volume-name,target=/data1 busybox sh
   637  ````
   638  
   639  When using SELinux, be aware that the host has no knowledge of container SELinux
   640  policy. Therefore, in the above example, if SELinux policy is enforced, the
   641  _/var/db_ directory is not writable to the container. A "Permission Denied"
   642  message occurs, and an **avc:** message is added to the host's syslog.
   643  
   644  To work around this, at time of writing this man page, the following command
   645  needs to be run in order for the proper SELinux policy type label to be attached
   646  to the host directory:
   647  
   648  ```
   649  $ chcon -Rt svirt_sandbox_file_t /var/db
   650  ```
   651  
   652  Now, writing to the _/data1_ volume in the container is allowed and the
   653  changes are reflected on the host in _/var/db_.
   654  
   655  ### Using alternative security labeling
   656  
   657  Override the default labeling scheme for each container by specifying
   658  the **--security-opt** flag. For example, specify the MCS/MLS level, a
   659  requirement for MLS systems. Specifying the level in the following command
   660  allows the same content to be shared between containers.
   661  
   662  ```
   663  podman run --security-opt label=level:s0:c100,c200 -i -t fedora bash
   664  ```
   665  
   666  An MLS example might be:
   667  
   668  ```
   669  $ podman run --security-opt label=level:TopSecret -i -t rhel7 bash
   670  ```
   671  
   672  To disable the security labeling for this container versus running with the
   673  #### **--permissive** flag, use the following command:
   674  
   675  ```
   676  $ podman run --security-opt label=disable -i -t fedora bash
   677  ```
   678  
   679  Tighten the security policy on the processes within a container by specifying an
   680  alternate type for the container. For example, run a container
   681  that is only allowed to listen on Apache ports by executing the following
   682  command:
   683  
   684  ```
   685  $ podman run --security-opt label=type:svirt_apache_t -i -t centos bash
   686  ```
   687  
   688  Note that an SELinux policy defining a **svirt_apache_t** type must be written.
   689  
   690  To mask additional specific paths in the container, specify the paths
   691  separated by a colon using the **mask** option with the **--security-opt**
   692  flag.
   693  
   694  ```
   695  $ podman run --security-opt mask=/foo/bar:/second/path fedora bash
   696  ```
   697  
   698  To unmask all the paths that are masked by default, set the **unmask** option to
   699  **ALL**. Or to only unmask specific paths, specify the paths as shown above with
   700  the **mask** option.
   701  
   702  ```
   703  $ podman run --security-opt unmask=ALL fedora bash
   704  ```
   705  
   706  To unmask all the paths that start with /proc, set the **unmask** option to
   707  **/proc/***.
   708  
   709  ```
   710  $ podman run --security-opt unmask=/proc/* fedora bash
   711  ```
   712  
   713  ```
   714  $ podman run --security-opt unmask=/foo/bar:/sys/firmware fedora bash
   715  ```
   716  
   717  ### Setting device weight via **--blkio-weight-device** flag.
   718  
   719  ```
   720  $ podman run -it --blkio-weight-device "/dev/sda:200" ubuntu
   721  ```
   722  
   723  ### Using a podman container with input from a pipe
   724  
   725  ```
   726  $ echo "asdf" | podman run --rm -i --entrypoint /bin/cat someimage
   727  asdf
   728  ```
   729  
   730  ### Setting automatic user namespace separated containers
   731  
   732  ```
   733  # podman run --userns=auto:size=65536 ubi8-micro cat /proc/self/uid_map
   734  0 2147483647      65536
   735  # podman run --userns=auto:size=65536 ubi8-micro cat /proc/self/uid_map
   736  0 2147549183      65536
   737  ```
   738  
   739  ### Setting Namespaced Kernel Parameters (Sysctls)
   740  
   741  The **--sysctl** sets namespaced kernel parameters (sysctls) in the
   742  container. For example, to turn on IP forwarding in the containers
   743  network namespace, run this command:
   744  
   745  ```
   746  $ podman run --sysctl net.ipv4.ip_forward=1 someimage
   747  ```
   748  
   749  Note that not all sysctls are namespaced. Podman does not support changing sysctls
   750  inside of a container that also modify the host system. As the kernel
   751  evolves we expect to see more sysctls become namespaced.
   752  
   753  See the definition of the **--sysctl** option above for the current list of
   754  supported sysctls.
   755  
   756  ### Set UID/GID mapping in a new user namespace
   757  
   758  Running a container in a new user namespace requires a mapping of
   759  the UIDs and GIDs from the host.
   760  
   761  ```
   762  $ podman run --uidmap 0:30000:7000 --gidmap 0:30000:7000 fedora echo hello
   763  ```
   764  
   765  ### Configuring Storage Options from the command line
   766  
   767  Podman allows for the configuration of storage by changing the values
   768  in the _/etc/container/storage.conf_ or by using global options. This
   769  shows how to set up and use fuse-overlayfs for a one-time run of busybox
   770  using global options.
   771  
   772  ```
   773  podman --log-level=debug --storage-driver overlay --storage-opt "overlay.mount_program=/usr/bin/fuse-overlayfs" run busybox /bin/sh
   774  ```
   775  
   776  ### Configure timezone in a container
   777  
   778  ```
   779  $ podman run --tz=local alpine date
   780  $ podman run --tz=Asia/Shanghai alpine date
   781  $ podman run --tz=US/Eastern alpine date
   782  ```
   783  
   784  ### Adding dependency containers
   785  
   786  The first container, container1, is not started initially, but must be running before container2 starts.
   787  The `podman run` command starts the container automatically before starting container2.
   788  
   789  ```
   790  $ podman create --name container1 -t -i fedora bash
   791  $ podman run --name container2 --requires container1 -t -i fedora bash
   792  ```
   793  
   794  Multiple containers can be required.
   795  
   796  ```
   797  $ podman create --name container1 -t -i fedora bash
   798  $ podman create --name container2 -t -i fedora bash
   799  $ podman run --name container3 --requires container1,container2 -t -i fedora bash
   800  ```
   801  
   802  ### Configure keep supplemental groups for access to volume
   803  
   804  ```
   805  $ podman run -v /var/lib/design:/var/lib/design --group-add keep-groups ubi8
   806  ```
   807  
   808  ### Configure execution domain for containers using personality flag
   809  
   810  ```
   811  $ podman run --name container1 --personality=LINUX32 fedora bash
   812  ```
   813  
   814  ### Run a container with external rootfs mounted as an overlay
   815  
   816  ```
   817  $ podman run --name container1 --rootfs /path/to/rootfs:O bash
   818  ```
   819  
   820  ### Handling Timezones in java applications in a container.
   821  
   822  In order to use a timezone other than UTC when running a
   823  Java application within a container, the `TZ` environment variable must be
   824  set within the container. Java applications ignores the value set with the
   825  `--tz` option.
   826  
   827  ```
   828  # Example run
   829  podman run -ti --rm  -e TZ=EST mytzimage
   830  lrwxrwxrwx. 1 root root 29 Nov  3 08:51 /etc/localtime -> ../usr/share/zoneinfo/Etc/UTC
   831  Now with default timezone:
   832  Fri Nov 19 18:10:55 EST 2021
   833  Java default sees the following timezone:
   834  2021-11-19T18:10:55.651130-05:00
   835  Forcing UTC:
   836  Fri Nov 19 23:10:55 UTC 2021
   837  ```
   838  
   839  ### Run a container connected to two networks (called net1 and net2) with a static ip
   840  
   841  ```
   842  $ podman run --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10 alpine ip addr
   843  ```
   844  
   845  ### Rootless Containers
   846  
   847  Podman runs as a non-root user on most systems. This feature requires that a new enough version of **shadow-utils**
   848  be installed. The **shadow-utils** package must include the **newuidmap**(1) and **newgidmap**(1) executables.
   849  
   850  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.
   851  
   852  Rootless Podman works better if the fuse-overlayfs and slirp4netns packages are installed.
   853  The **fuse-overlayfs** package provides a userspace overlay storage driver, otherwise users need to use
   854  the **vfs** storage driver, which can be disk space expensive and less
   855  performant than other drivers.
   856  
   857  To enable VPN on the container, slirp4netns or pasta needs to be specified;
   858  without either, containers need to be run with the --network=host flag.
   859  
   860  ## ENVIRONMENT
   861  
   862  Environment variables within containers can be set using multiple different options,
   863  in the following order of precedence (later entries override earlier entries):
   864  
   865  - Container image: Any environment variables specified in the container image.
   866  - **--http-proxy**: By default, several environment variables are passed in from the host, such as **http_proxy** and **no_proxy**. See **--http-proxy** for details.
   867  - **--env-host**: Host environment of the process executing Podman is added.
   868  - **--env-file**: Any environment variables specified via env-files. If multiple files are specified, then they override each other in order of entry.
   869  - **--env**: Any environment variables specified overrides previous settings.
   870  
   871  Run containers and set the environment ending with a __*__.
   872  The trailing __*__ glob functionality is only active when no value is specified:
   873  
   874  ```
   875  $ export ENV1=a
   876  $ podman run --env 'ENV*' alpine env | grep ENV
   877  ENV1=a
   878  $ podman run --env 'ENV*=b' alpine env | grep ENV
   879  ENV*=b
   880  ```
   881  
   882  ## CONMON
   883  
   884  When Podman starts a container it actually executes the conmon program, which
   885  then executes the OCI Runtime.  Conmon is the container monitor.  It is a small
   886  program whose job is to watch the primary process of the container, and if the
   887  container dies, save the exit code.  It also holds open the tty of the
   888  container, so that it can be attached to later. This is what allows Podman to
   889  run in detached mode (backgrounded), so Podman can exit but conmon continues to
   890  run.  Each container has their own instance of conmon. Conmon waits for the
   891  container to exit, gathers and saves the exit code, and then launches a Podman
   892  process to complete the container cleanup, by shutting down the network and
   893  storage.   For more information about conmon, see the conmon(8) man
   894  page.
   895  
   896  ## FILES
   897  
   898  **/etc/subuid**
   899  
   900  **/etc/subgid**
   901  
   902  NOTE: Use the environment variable `TMPDIR` to change the temporary storage location of downloaded container images. Podman defaults to use `/var/tmp`.
   903  
   904  ## SEE ALSO
   905  **[podman(1)](podman.1.md)**, **[podman-save(1)](podman-save.1.md)**, **[podman-ps(1)](podman-ps.1.md)**, **[podman-attach(1)](podman-attach.1.md)**, **[podman-pod-create(1)](podman-pod-create.1.md)**, **[podman-port(1)](podman-port.1.md)**, **[podman-start(1)](podman-start.1.md)**, **[podman-kill(1)](podman-kill.1.md)**, **[podman-stop(1)](podman-stop.1.md)**, **[podman-generate-systemd(1)](podman-generate-systemd.1.md)**, **[podman-rm(1)](podman-rm.1.md)**, **[subgid(5)](https://www.unix.com/man-page/linux/5/subgid)**, **[subuid(5)](https://www.unix.com/man-page/linux/5/subuid)**, **[containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)**, **[systemd.unit(5)](https://www.freedesktop.org/software/systemd/man/systemd.unit.html)**, **[setsebool(8)](https://man7.org/linux/man-pages/man8/setsebool.8.html)**, **[slirp4netns(1)](https://github.com/rootless-containers/slirp4netns/blob/master/slirp4netns.1.md)**, **[pasta(1)](https://passt.top/builds/latest/web/passt.1.html)**, **[fuse-overlayfs(1)](https://github.com/containers/fuse-overlayfs/blob/main/fuse-overlayfs.1.md)**, **proc(5)**, **[conmon(8)](https://github.com/containers/conmon/blob/main/docs/conmon.8.md)**, **personality(2)**
   906  
   907  ## HISTORY
   908  September 2018, updated by Kunal Kushwaha `<kushwaha_kunal_v7@lab.ntt.co.jp>`
   909  
   910  October 2017, converted from Docker documentation to Podman by Dan Walsh for Podman `<dwalsh@redhat.com>`
   911  
   912  November 2015, updated by Sally O'Malley `<somalley@redhat.com>`
   913  
   914  June 2014, updated by Sven Dowideit `<SvenDowideit@home.org.au>`
   915  
   916  April 2014, Originally compiled by William Henry `<whenry@redhat.com>` based on docker.com source material and internal work.
   917  
   918  ## FOOTNOTES
   919  <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 needs to 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.