From 2bcee9f627b2cd1e3fe588b581aff05821f5841d Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 9 Aug 2022 15:02:08 -0600 Subject: Man pages: refactor common options Continued. Harder-to-review ones this time. Signed-off-by: Ed Santiago --- docs/source/markdown/.gitignore | 2 + docs/source/markdown/options/add-host.md | 6 + docs/source/markdown/options/cgroup-parent.md | 5 + docs/source/markdown/options/cgroupns.md | 10 + docs/source/markdown/options/cgroups.md | 10 + docs/source/markdown/options/conmon-pidfile.md | 4 + docs/source/markdown/options/cpu-period.md | 10 + docs/source/markdown/options/cpu-quota.md | 12 + docs/source/markdown/options/cpu-rt-period.md | 7 + docs/source/markdown/options/cpu-rt-runtime.md | 10 + docs/source/markdown/options/cpu-shares.md | 35 + docs/source/markdown/options/cpuset-cpus.md | 5 + docs/source/markdown/options/cpuset-mems.md | 8 + docs/source/markdown/options/no-hosts.md | 5 + docs/source/markdown/podman-build.1.md | 1174 -------------------- docs/source/markdown/podman-build.1.md.in | 1097 ++++++++++++++++++ .../source/markdown/podman-container-clone.1.md.in | 94 +- docs/source/markdown/podman-create.1.md.in | 134 +-- docs/source/markdown/podman-kube-play.1.md | 329 ------ docs/source/markdown/podman-kube-play.1.md.in | 326 ++++++ docs/source/markdown/podman-pod-clone.1.md.in | 54 +- docs/source/markdown/podman-pod-create.1.md.in | 71 +- docs/source/markdown/podman-run.1.md.in | 134 +-- hack/markdown-preprocess | 2 +- hack/markdown-preprocess-review | 4 +- 25 files changed, 1600 insertions(+), 1948 deletions(-) create mode 100644 docs/source/markdown/options/add-host.md create mode 100644 docs/source/markdown/options/cgroup-parent.md create mode 100644 docs/source/markdown/options/cgroupns.md create mode 100644 docs/source/markdown/options/cgroups.md create mode 100644 docs/source/markdown/options/conmon-pidfile.md create mode 100644 docs/source/markdown/options/cpu-period.md create mode 100644 docs/source/markdown/options/cpu-quota.md create mode 100644 docs/source/markdown/options/cpu-rt-period.md create mode 100644 docs/source/markdown/options/cpu-rt-runtime.md create mode 100644 docs/source/markdown/options/cpu-shares.md create mode 100644 docs/source/markdown/options/cpuset-cpus.md create mode 100644 docs/source/markdown/options/cpuset-mems.md create mode 100644 docs/source/markdown/options/no-hosts.md delete mode 100644 docs/source/markdown/podman-build.1.md create mode 100644 docs/source/markdown/podman-build.1.md.in delete mode 100644 docs/source/markdown/podman-kube-play.1.md create mode 100644 docs/source/markdown/podman-kube-play.1.md.in diff --git a/docs/source/markdown/.gitignore b/docs/source/markdown/.gitignore index 622ec33ff..6689b5b71 100644 --- a/docs/source/markdown/.gitignore +++ b/docs/source/markdown/.gitignore @@ -1,5 +1,7 @@ +podman-build.1.md podman-container-clone.1.md podman-create.1.md +podman-kube-play.1.md podman-pod-clone.1.md podman-pod-create.1.md podman-pull.1.md diff --git a/docs/source/markdown/options/add-host.md b/docs/source/markdown/options/add-host.md new file mode 100644 index 000000000..a6021cd3b --- /dev/null +++ b/docs/source/markdown/options/add-host.md @@ -0,0 +1,6 @@ +#### **--add-host**=*host:ip* + +Add a custom host-to-IP mapping (host:ip) + +Add a line to /etc/hosts. The format is hostname:ip. The **--add-host** +option can be set multiple times. Conflicts with the **--no-hosts** option. diff --git a/docs/source/markdown/options/cgroup-parent.md b/docs/source/markdown/options/cgroup-parent.md new file mode 100644 index 000000000..f376e4860 --- /dev/null +++ b/docs/source/markdown/options/cgroup-parent.md @@ -0,0 +1,5 @@ +#### **--cgroup-parent**=*path* + +Path to cgroups under which the cgroup for the <> 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. diff --git a/docs/source/markdown/options/cgroupns.md b/docs/source/markdown/options/cgroupns.md new file mode 100644 index 000000000..6117b3fe1 --- /dev/null +++ b/docs/source/markdown/options/cgroupns.md @@ -0,0 +1,10 @@ +#### **--cgroupns**=*mode* + +Set the cgroup namespace mode for the container. + +- **host**: use the host's cgroup namespace inside the container. +- **container:**_id_: join the namespace of the specified container. +- **private**: create a new cgroup namespace. +- **ns:**_path_: join the namespace at the specified path. + +If the host uses cgroups v1, the default is set to **host**. On cgroups v2, the default is **private**. diff --git a/docs/source/markdown/options/cgroups.md b/docs/source/markdown/options/cgroups.md new file mode 100644 index 000000000..0dbbb15f3 --- /dev/null +++ b/docs/source/markdown/options/cgroups.md @@ -0,0 +1,10 @@ +#### **--cgroups**=*how* + +Determines whether the container will create CGroups. + +Default is **enabled**. + +The **enabled** option will create a new cgroup under the cgroup-parent. +The **disabled** option will force the container to not create CGroups, and thus conflicts with CGroup options (**--cgroupns** and **--cgroup-parent**). +The **no-conmon** option disables a new CGroup only for the **conmon** process. +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**. diff --git a/docs/source/markdown/options/conmon-pidfile.md b/docs/source/markdown/options/conmon-pidfile.md new file mode 100644 index 000000000..e0e337cc8 --- /dev/null +++ b/docs/source/markdown/options/conmon-pidfile.md @@ -0,0 +1,4 @@ +#### **--conmon-pidfile**=*file* + +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. +(This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) diff --git a/docs/source/markdown/options/cpu-period.md b/docs/source/markdown/options/cpu-period.md new file mode 100644 index 000000000..8df6445e9 --- /dev/null +++ b/docs/source/markdown/options/cpu-period.md @@ -0,0 +1,10 @@ +#### **--cpu-period**=*limit* + +Set the CPU period for the Completely Fair Scheduler (CFS), which is a +duration in microseconds. Once the container's CPU quota is used up, it will +not be scheduled to run until the current period ends. Defaults to 100000 +microseconds. + +On some systems, changing the CPU limits may not be allowed for non-root +users. For more details, see +https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error diff --git a/docs/source/markdown/options/cpu-quota.md b/docs/source/markdown/options/cpu-quota.md new file mode 100644 index 000000000..67b9dee8c --- /dev/null +++ b/docs/source/markdown/options/cpu-quota.md @@ -0,0 +1,12 @@ +#### **--cpu-quota**=*limit* + +Limit the CPU Completely Fair Scheduler (CFS) quota. + +Limit the container's CPU usage. By default, containers run with the full +CPU resource. The limit is a number in microseconds. If a number is provided, +the container will be allowed to use that much CPU time until the CPU period +ends (controllable via **--cpu-period**). + +On some systems, changing the CPU limits may not be allowed for non-root +users. For more details, see +https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error diff --git a/docs/source/markdown/options/cpu-rt-period.md b/docs/source/markdown/options/cpu-rt-period.md new file mode 100644 index 000000000..9014beb33 --- /dev/null +++ b/docs/source/markdown/options/cpu-rt-period.md @@ -0,0 +1,7 @@ +#### **--cpu-rt-period**=*microseconds* + +Limit the CPU real-time period in microseconds. + +Limit the container's Real Time CPU usage. This option tells the kernel to restrict the container's Real Time CPU usage to the period specified. + +This option is not supported on cgroups V2 systems. diff --git a/docs/source/markdown/options/cpu-rt-runtime.md b/docs/source/markdown/options/cpu-rt-runtime.md new file mode 100644 index 000000000..05b1d3b96 --- /dev/null +++ b/docs/source/markdown/options/cpu-rt-runtime.md @@ -0,0 +1,10 @@ +#### **--cpu-rt-runtime**=*microseconds* + +Limit the CPU real-time runtime in microseconds. + +Limit the containers Real Time CPU usage. This option tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex: +Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks. + +The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. + +This option is not supported on cgroups V2 systems. diff --git a/docs/source/markdown/options/cpu-shares.md b/docs/source/markdown/options/cpu-shares.md new file mode 100644 index 000000000..a5aacd2ca --- /dev/null +++ b/docs/source/markdown/options/cpu-shares.md @@ -0,0 +1,35 @@ +#### **--cpu-shares**, **-c**=*shares* + +CPU shares (relative weight). + +By default, all containers get the same proportion of CPU cycles. This +proportion can be modified by changing the container's CPU share weighting +relative to the combined weight of all the running containers. +Default weight is **1024**. + +The proportion will only apply when CPU-intensive processes are running. +When tasks in one container are idle, other containers can use the +left-over CPU time. The actual amount of CPU time will vary depending on +the number of containers running on the system. + +For example, consider three containers, one has a cpu-share of 1024 and +two others have a cpu-share setting of 512. When processes in all three +containers attempt to use 100% of CPU, the first container would receive +50% of the total CPU time. If a fourth container is added with a cpu-share +of 1024, the first container only gets 33% of the CPU. The remaining containers +receive 16.5%, 16.5% and 33% of the CPU. + +On a multi-core system, the shares of CPU time are distributed over all CPU +cores. Even if a container is limited to less than 100% of CPU time, it can +use 100% of each individual CPU core. + +For example, consider a system with more than three cores. +If the container _C0_ is started with **--cpu-shares=512** running one process, +and another container _C1_ with **--cpu-shares=1024** running two processes, +this can result in the following division of CPU shares: + +| PID | container | CPU | CPU share | +| ---- | ----------- | ------- | ------------ | +| 100 | C0 | 0 | 100% of CPU0 | +| 101 | C1 | 1 | 100% of CPU1 | +| 102 | C1 | 2 | 100% of CPU2 | diff --git a/docs/source/markdown/options/cpuset-cpus.md b/docs/source/markdown/options/cpuset-cpus.md new file mode 100644 index 000000000..d717516a0 --- /dev/null +++ b/docs/source/markdown/options/cpuset-cpus.md @@ -0,0 +1,5 @@ +#### **--cpuset-cpus**=*number* + +CPUs in which to allow execution. Can be specified as a comma-separated list +(e.g. **0,1**), as a range (e.g. **0-3**), or any combination thereof +(e.g. **0-3,7,11-15**). diff --git a/docs/source/markdown/options/cpuset-mems.md b/docs/source/markdown/options/cpuset-mems.md new file mode 100644 index 000000000..d2d13eb54 --- /dev/null +++ b/docs/source/markdown/options/cpuset-mems.md @@ -0,0 +1,8 @@ +#### **--cpuset-mems**=*nodes* + +Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on +NUMA systems. + +If there are four memory nodes on the system (0-3), use **--cpuset-mems=0,1** +then processes in the container will only use memory from the first +two memory nodes. diff --git a/docs/source/markdown/options/no-hosts.md b/docs/source/markdown/options/no-hosts.md new file mode 100644 index 000000000..5b1e95b86 --- /dev/null +++ b/docs/source/markdown/options/no-hosts.md @@ -0,0 +1,5 @@ +#### **--no-hosts** + +Do not create _/etc/hosts_ for the <>. +By default, Podman will manage _/etc/hosts_, adding the container's own IP address and any hosts from **--add-host**. +**--no-hosts** disables this, and the image's _/etc/hosts_ will be preserved unmodified. diff --git a/docs/source/markdown/podman-build.1.md b/docs/source/markdown/podman-build.1.md deleted file mode 100644 index a5011f4aa..000000000 --- a/docs/source/markdown/podman-build.1.md +++ /dev/null @@ -1,1174 +0,0 @@ -% podman-build(1) - -## NAME -podman\-build - Build a container image using a Containerfile - -## SYNOPSIS -**podman build** [*options*] [*context*] - -**podman image build** [*options*] [*context*] - -## DESCRIPTION -**podman build** Builds an image using instructions from one or more -Containerfiles or Dockerfiles and a specified build context directory. A -Containerfile uses the same syntax as a Dockerfile internally. For this -document, a file referred to as a Containerfile can be a file named -either 'Containerfile' or 'Dockerfile'. - -The build context directory can be specified as the http(s) URL of an archive, -git repository or Containerfile. - -If no context directory is specified, then Podman will assume the current -working directory as the build context, which should contain the Containerfile. - -Containerfiles ending with a ".in" suffix will be preprocessed via CPP(1). This -can be useful to decompose Containerfiles into several reusable parts that can -be used via CPP's **#include** directive. Notice, a Containerfile.in file can -still be used by other tools when manually preprocessing them via `cpp -E`. - -When the URL is an archive, the contents of the URL is downloaded to a temporary -location and extracted before execution. - -When the URL is a Containerfile, the Containerfile is downloaded to a temporary -location. - -When a Git repository is set as the URL, the repository is cloned locally and -then set as the context. - -NOTE: `podman build` uses code sourced from the `Buildah` project to build -container images. This `Buildah` code creates `Buildah` containers for the -`RUN` options in container storage. In certain situations, when the -`podman build` crashes or users kill the `podman build` process, these external -containers can be left in container storage. Use the `podman ps --all --storage` -command to see these containers. External containers can be removed with the -`podman rm --storage` command. - -`podman buildx build` command is an alias of `podman build`. Not all `buildx build` features are available in Podman. The `buildx build` option is provided for scripting compatibility. - -## OPTIONS - -#### **--add-host**=*host* - -Add a custom host-to-IP mapping (host:ip) - -Add a line to /etc/hosts. The format is hostname:ip. The **--add-host** option -can be set multiple times. Conflicts with the --no-hosts option. - -#### **--all-platforms** - -Instead of building for a set of platforms specified using the **--platform** option, inspect the build's base images, and build for all of the platforms for which they are all available. Stages that use *scratch* as a starting point can not be inspected, so at least one non-*scratch* stage must be present for detection to work usefully. - -#### **--annotation**=*annotation* - -Add an image *annotation* (e.g. annotation=*value*) to the image metadata. Can -be used multiple times. - -Note: this information is not present in Docker image formats, so it is -discarded when writing images in Docker formats. - -#### **--arch**=*arch* - -Set the architecture of the image to be built, and that of the base image to be -pulled, if the build uses one, to the provided value instead of using the -architecture of the build host. (Examples: arm, arm64, 386, amd64, ppc64le, -s390x) - -#### **--authfile**=*path* - -Path of the authentication file. Default is -${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`. -If the authorization state is not found there, $HOME/.docker/config.json is -checked, which is set using `docker login`. - -Note: You can also override the default path of the authentication file by -setting the REGISTRY\_AUTH\_FILE environment variable. -`export REGISTRY_AUTH_FILE=path` - -#### **--build-arg**=*arg=value* - -Specifies a build argument and its value, which will be interpolated in -instructions read from the Containerfiles in the same way that environment -variables are, but which will not be added to environment variable list in the -resulting image's configuration. - -#### **--build-context**=*name=value* - -Specify an additional build context using its short name and its location. -Additional build contexts can be referenced in the same manner as we access -different stages in COPY instruction. - -Valid values could be: - -* Local directory – e.g. --build-context project2=../path/to/project2/src (This option is not available with the remote Podman client. On Podman machine setup (i.e macOS and Winows) path must exists on the machine VM) -* HTTP URL to a tarball – e.g. --build-context src=https://example.org/releases/src.tar -* Container image – specified with a container-image:// prefix, e.g. --build-context alpine=container-image://alpine:3.15, (also accepts docker://, docker-image://) - -On the Containerfile side, you can reference the build context on all -commands that accept the “from” parameter. Here’s how that might look: - -```dockerfile -FROM [name] -COPY --from=[name] ... -RUN --mount=from=[name] … -``` - -The value of [name] is matched with the following priority order: - -* Named build context defined with --build-context [name]=.. -* Stage defined with AS [name] inside Containerfile -* Image [name], either local or in a remote registry - -#### **--cache-from** - -Repository to utilize as a potential cache source. When specified, Buildah will try to look for -cache images in the specified repository and will attempt to pull cache images instead of actually -executing the build steps locally. Buildah will only attempt to pull previously cached images if they -are considered as valid cache hits. - -Use the `--cache-to` option to populate a remote repository with cache content. - -Example - -```bash -# populate a cache and also consult it -buildah build -t test --layers --cache-to registry/myrepo/cache --cache-from registry/myrepo/cache . -``` - -Note: `--cache-from` option is ignored unless `--layers` is specified. - -#### **--cache-to** - -Set this flag to specify a remote repository that will be used to store cache images. Buildah will attempt to -push newly built cache image to the remote repository. - -Note: Use the `--cache-from` option in order to use cache content in a remote repository. - -Example - -```bash -# populate a cache and also consult it -buildah build -t test --layers --cache-to registry/myrepo/cache --cache-from registry/myrepo/cache . -``` - -Note: `--cache-to` option is ignored unless `--layers` is specified. - -#### **--cache-ttl** - -Limit the use of cached images to only consider images with created timestamps less than *duration* ago. -For example if `--cache-ttl=1h` is specified, Buildah will only consider intermediate cache images which are created -under the duration of one hour, and intermediate cache images outside this duration will be ignored. - -#### **--cap-add**=*CAP\_xxx* - -When executing RUN instructions, run the command specified in the instruction -with the specified capability added to its capability set. -Certain capabilities are granted by default; this option can be used to add -more. - -#### **--cap-drop**=*CAP\_xxx* - -When executing RUN instructions, run the command specified in the instruction -with the specified capability removed from its capability set. -The CAP\_AUDIT\_WRITE, CAP\_CHOWN, CAP\_DAC\_OVERRIDE, CAP\_FOWNER, -CAP\_FSETID, CAP\_KILL, CAP\_MKNOD, CAP\_NET\_BIND\_SERVICE, CAP\_SETFCAP, -CAP\_SETGID, CAP\_SETPCAP, CAP\_SETUID, and CAP\_SYS\_CHROOT capabilities are -granted by default; this option can be used to remove them. - -If a capability is specified to both the **--cap-add** and **--cap-drop** -options, it will be dropped, regardless of the order in which the options were -given. - -#### **--cert-dir**=*path* - -Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry. (Default: /etc/containers/certs.d) -Please refer to containers-certs.d(5) for details. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--cgroup-parent**=*path* - -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. - -#### **--cgroupns**=*how* - -Sets the configuration for cgroup namespaces when handling `RUN` instructions. -The configured value can be "" (the empty string) or "private" to indicate -that a new cgroup namespace should be created, or it can be "host" to indicate -that the cgroup namespace in which `buildah` itself is being run should be reused. - -#### **--compress** - -This option is added to be aligned with other containers CLIs. -Podman doesn't communicate with a daemon or a remote server. -Thus, compressing the data before sending it is irrelevant to Podman. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--cpp-flag**=*flags* - -Set additional flags to pass to the C Preprocessor cpp(1). Containerfiles ending with a ".in" suffix will be preprocessed via cpp(1). This option can be used to pass additional flags to cpp.Note: You can also set default CPPFLAGS by setting the BUILDAH_CPPFLAGS environment variable (e.g., export BUILDAH_CPPFLAGS="-DDEBUG"). - -#### **--cpu-period**=*limit* - -Set the CPU period for the Completely Fair Scheduler (CFS), which is a -duration in microseconds. Once the container's CPU quota is used up, it will -not be scheduled to run until the current period ends. Defaults to 100000 -microseconds. - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error - -#### **--cpu-quota**=*limit* - -Limit the CPU Completely Fair Scheduler (CFS) quota. - -Limit the container's CPU usage. By default, containers run with the full -CPU resource. The limit is a number in microseconds. If you provide a number, -the container will be allowed to use that much CPU time until the CPU period -ends (controllable via **--cpu-period**). - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error - -#### **--cpu-shares**, **-c**=*shares* - -CPU shares (relative weight) - -By default, all containers get the same proportion of CPU cycles. This -proportion can be modified by changing the container's CPU share weighting -relative to the weighting of all other running containers. - -To modify the proportion from the default of 1024, use the **--cpu-shares** -option to set the weighting to 2 or higher. - -The proportion will only apply when CPU-intensive processes are running. -When tasks in one container are idle, other containers can use the -left-over CPU time. The actual amount of CPU time will vary depending on -the number of containers running on the system. - -For example, consider three containers, one has a cpu-share of 1024 and -two others have a cpu-share setting of 512. When processes in all three -containers attempt to use 100% of CPU, the first container would receive -50% of the total CPU time. If you add a fourth container with a cpu-share -of 1024, the first container only gets 33% of the CPU. The remaining containers -receive 16.5%, 16.5% and 33% of the CPU. - -On a multi-core system, the shares of CPU time are distributed over all CPU -cores. Even if a container is limited to less than 100% of CPU time, it can -use 100% of each individual CPU core. - -For example, consider a system with more than three cores. If you start one -container **{C0}** with **-c=512** running one process, and another container -**{C1}** with **-c=1024** running two processes, this can result in the -following -division of CPU shares: - - PID container CPU CPU share - 100 {C0} 0 100% of CPU0 - 101 {C1} 1 100% of CPU1 - 102 {C1} 2 100% of CPU2 - -#### **--cpuset-cpus**=*num* - - CPUs in which to allow execution (0-3, 0,1) - -#### **--cpuset-mems**=*nodes* - -Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on -NUMA systems. - -If you have four memory nodes on your system (0-3), use `--cpuset-mems=0,1` -then processes in your container will only use memory from the first -two memory nodes. - -#### **--creds**=*creds* - -The [username[:password]] to use to authenticate with the registry if required. -If one or both values are not supplied, a command line prompt will appear and -the value can be entered. The password is entered without echo. - -#### **--decryption-key**=*key[:passphrase]* - -The [key[:passphrase]] to be used for decryption of images. Key can point to -keys and/or certificates. Decryption will be tried with all keys. If the key is -protected by a passphrase, it is required to be passed in the argument and -omitted otherwise. - -#### **--device**=*host-device[:container-device][:permissions]* - -Add a host device to the container. Optional *permissions* parameter -can be used to specify device permissions, it is combination of -**r** for read, **w** for write, and **m** for **mknod**(2). - -Example: **--device=/dev/sdc:/dev/xvdc:rwm**. - -Note: if *host-device* is a symbolic link then it will be resolved first. -The container will only store the major and minor numbers of the host device. - -Note: if the user only has access rights via a group, accessing the device -from inside a rootless container will fail. The **[crun(1)](https://github.com/containers/crun/tree/main/crun.1.md)** runtime offers a -workaround for this by adding the option -**--annotation run.oci.keep_original_groups=1**. - -#### **--disable-compression**, **-D** - -Don't compress filesystem layers when building the image unless it is required -by the location where the image is being written. This is the default setting, -because image layers are compressed automatically when they are pushed to -registries, and images being written to local storage would only need to be -decompressed again to be stored. Compression can be forced in all cases by -specifying **--disable-compression=false**. - -#### **--disable-content-trust** - -This is a Docker specific option to disable image verification to a container -registry and is not supported by Podman. This option is a NOOP and provided -solely for scripting compatibility. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--dns**=*dns* - -Set custom DNS servers to be used during the build. - -This option can be used to override the DNS configuration passed to the -container. Typically this is necessary when the host DNS configuration is -invalid for the container (e.g., 127.0.0.1). When this is the case the `--dns` -option is necessary for every run. - -The special value **none** can be specified to disable creation of -/etc/resolv.conf in the container by Podman. The /etc/resolv.conf file in the -image will be used without changes. - -#### **--dns-option**=*option* - -Set custom DNS options to be used during the build. - -#### **--dns-search**=*domain* - -Set custom DNS search domains to be used during the build. - -#### **--env**=*env[=value]* - -Add a value (e.g. env=*value*) to the built image. Can be used multiple times. -If neither `=` nor a `*value*` are specified, but *env* is set in the current -environment, the value from the current environment will be added to the image. -To remove an environment variable from the built image, use the `--unsetenv` -option. - -#### **--file**, **-f**=*Containerfile* - -Specifies a Containerfile which contains instructions for building the image, -either a local file or an **http** or **https** URL. If more than one -Containerfile is specified, *FROM* instructions will only be accepted from the -first specified file. - -If a build context is not specified, and at least one Containerfile is a -local file, the directory in which it resides will be used as the build -context. - -If you specify `-f -`, the Containerfile contents will be read from stdin. - -#### **--force-rm** - -Always remove intermediate containers after a build, even if the build fails -(default true). - -#### **--format** - -Control the format for the built image's manifest and configuration data. -Recognized formats include *oci* (OCI image-spec v1.0, the default) and -*docker* (version 2, using schema format 2 for the manifest). - -Note: You can also override the default format by setting the BUILDAH\_FORMAT -environment variable. `export BUILDAH_FORMAT=docker` - -#### **--from** - -Overrides the first `FROM` instruction within the Containerfile. If there are multiple -FROM instructions in a Containerfile, only the first is changed. - -#### **--help**, **-h** - -Print usage statement - -#### **--http-proxy** - -Pass through HTTP Proxy environment variables. - -#### **--identity-label** - -Adds default identity label `io.buildah.version` if set. (default true). - -#### **--ignorefile** - -Path to an alternative .containerignore file. - -#### **--iidfile**=*ImageIDfile* - -Write the built image's ID to the file. When `--platform` is specified more -than once, attempting to use this option will trigger an error. - -#### **--ipc**=*how* - -Sets the configuration for IPC namespaces when handling `RUN` instructions. -The configured value can be "" (the empty string) or "container" to indicate -that a new IPC namespace should be created, or it can be "host" to indicate -that the IPC namespace in which `podman` itself is being run should be reused, -or it can be the path to an IPC namespace which is already in use by -another process. - -#### **--isolation**=*type* - -Controls what type of isolation is used for running processes as part of `RUN` -instructions. Recognized types include *oci* (OCI-compatible runtime, the -default), *rootless* (OCI-compatible runtime invoked using a modified -configuration and its --rootless option enabled, with *--no-new-keyring ---no-pivot* added to its *create* invocation, with network and UTS namespaces -disabled, and IPC, PID, and user namespaces enabled; the default for -unprivileged users), and *chroot* (an internal wrapper that leans more toward -chroot(1) than container technology). - -Note: You can also override the default isolation type by setting the -BUILDAH\_ISOLATION environment variable. `export BUILDAH_ISOLATION=oci` - -#### **--jobs**=*number* - -Run up to N concurrent stages in parallel. If the number of jobs is greater -than 1, stdin will be read from /dev/null. If 0 is specified, then there is -no limit in the number of jobs that run in parallel. - -#### **--label**=*label* - -Add an image *label* (e.g. label=*value*) to the image metadata. Can be used -multiple times. - -Users can set a special LABEL **io.containers.capabilities=CAP1,CAP2,CAP3** in -a Containerfile that specifies the list of Linux capabilities required for the -container to run properly. This label specified in a container image tells -Podman to run the container with just these capabilities. Podman launches the -container with just the specified capabilities, as long as this list of -capabilities is a subset of the default list. - -If the specified capabilities are not in the default set, Podman will -print an error message and will run the container with the default capabilities. - -#### **--layers** - -Cache intermediate images during the build process (Default is `true`). - -Note: You can also override the default value of layers by setting the -BUILDAH\_LAYERS environment variable. `export BUILDAH_LAYERS=true` - -#### **--logfile**=*filename* - -Log output which would be sent to standard output and standard error to the -specified file instead of to standard output and standard error. -This option is not supported on the remote client, including Mac and Windows -(excluding WSL2) machines. - -#### **--logsplit**=*bool-value* - -If `--logfile` and `--platform` are specified, the `--logsplit` option allows -end-users to split the log file for each platform into different files in the -following format: `${logfile}_${platform-os}_${platform-arch}`. -This option is not supported on the remote client, including Mac and Windows -(excluding WSL2) machines. - -#### **--manifest**=*manifest* - -Name of the manifest list to which the image will be added. Creates the manifest list -if it does not exist. This option is useful for building multi architecture images. - -#### **--memory**, **-m**=*LIMIT* - -Memory limit (format: `[]`, where unit = b (bytes), k (kibibytes), -m (mebibytes), or g (gibibytes)) - -Allows you to constrain the memory available to a container. If the host -supports swap memory, then the **-m** memory setting can be larger than physical -RAM. If a limit of 0 is specified (not using **-m**), the container's memory is -not limited. The actual limit may be rounded up to a multiple of the operating -system's page size (the value would be very large, that's millions of -trillions). - -#### **--memory-swap**=*LIMIT* - -A limit value equal to memory plus swap. Must be used with the **-m** -(**--memory**) option. The swap `LIMIT` should always be larger than **-m** -(**--memory**) value. By default, the swap `LIMIT` will be set to double -the value of --memory. - -The format of `LIMIT` is `[]`. Unit can be `b` (bytes), -`k` (kibibytes), `m` (mebibytes), or `g` (gibibytes). If you don't specify a -unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. - -#### **--network**=*mode*, **--net** - -Sets the configuration for network namespaces when handling `RUN` instructions. - -Valid _mode_ values are: - -- **none**: no networking. -- **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. -- **ns:**_path_: path to a network namespace to join. -- **private**: create a new namespace for the container (default) -- **\**: Join the network with the given name or ID, e.g. use `--network mynet` to join the network with the name mynet. Only supported for rootful users. - -#### **--no-cache** - -Do not use existing cached images for the container build. Build from the start -with a new set of cached layers. - -#### **--no-hosts** - -Do not create _/etc/hosts_ for the container. -By default, Podman will manage _/etc/hosts_, adding the container's own IP address and any hosts from **--add-host**. -**--no-hosts** disables this, and the image's _/etc/hosts_ will be preserved unmodified. -This option conflicts with **--add-host**. - -#### **--omit-history** - -Omit build history information in the built image. (default false). - -This option is useful for the cases where end users explicitly -want to set `--omit-history` to omit the optional `History` from -built images or when working with images built using build tools that -do not include `History` information in their images. - -#### **--os**=*string* - -Set the OS of the image to be built, and that of the base image to be pulled, -if the build uses one, instead of using the current operating system of the -build host. - -#### **--os-feature**=*feature* - -Set the name of a required operating system *feature* for the image which will -be built. By default, if the image is not based on *scratch*, the base image's -required OS feature list is kept, if the base image specified any. This option -is typically only meaningful when the image's OS is Windows. - -If *feature* has a trailing `-`, then the *feature* is removed from the set of -required features which will be listed in the image. - -#### **--os-version**=*version* - -Set the exact required operating system *version* for the image which will be -built. By default, if the image is not based on *scratch*, the base image's -required OS version is kept, if the base image specified one. This option is -typically only meaningful when the image's OS is Windows, and is typically set in -Windows base images, so using this option is usually unnecessary. - -#### **--output**, **-o**=*output-opts* - -Output destination (format: type=local,dest=path) - -The --output (or -o) option extends the default behavior of building a container image by allowing users to export the contents of the image as files on the local filesystem, which can be useful for generating local binaries, code generation, etc. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -The value for --output is a comma-separated sequence of key=value pairs, defining the output type and options. - -Supported _keys_ are: -- **dest**: Destination path for exported output. Valid value is absolute or relative path, `-` means the standard output. -- **type**: Defines the type of output to be used. Valid values is documented below. - -Valid _type_ values are: -- **local**: write the resulting build files to a directory on the client-side. -- **tar**: write the resulting files as a single tarball (.tar). - -If no type is specified, the value defaults to **local**. -Alternatively, instead of a comma-separated sequence, the value of **--output** can be just a destination (in the `**dest** format) (e.g. `--output some-path`, `--output -`) where `--output some-path` is treated as if **type=local** and `--output -` is treated as if **type=tar**. - -#### **--pid**=*pid* - -Sets the configuration for PID namespaces when handling `RUN` instructions. -The configured value can be "" (the empty string) or "container" to indicate -that a new PID namespace should be created, or it can be "host" to indicate -that the PID namespace in which `podman` itself is being run should be reused, -or it can be the path to a PID namespace which is already in use by another -process. - -#### **--platform**=*os/arch[/variant][,...]* - -Set the *os/arch* of the built image (and its base image, if your build uses one) -to the provided value instead of using the current operating system and -architecture of the host (for example `linux/arm`). If `--platform` is set, -then the values of the `--arch`, `--os`, and `--variant` options will be -overridden. - -The `--platform` option can be specified more than once, or given a -comma-separated list of values as its argument. When more than one platform is -specified, the `--manifest` option should be used instead of the `--tag` -option. - -Os/arch pairs are those used by the Go Programming Language. In several cases -the *arch* value for a platform differs from one produced by other tools such as -the `arch` command. Valid OS and architecture name combinations are listed as -values for $GOOS and $GOARCH at https://golang.org/doc/install/source#environment, -and can also be found by running `go tool dist list`. - -While `podman build` is happy to use base images and build images for any -platform that exists, `RUN` instructions will not be able to succeed without -the help of emulation provided by packages like `qemu-user-static`. - -#### **--pull**=*policy* - -Pull image policy. The default is **always**. - -- **always**, **true**: Always pull the image and throw an error if the pull fails. -- **missing**: Pull the image only if it could not be found in the local containers storage. Throw an error if no image could be found and the pull fails. -- **never**, **false**: Never pull the image but use the one from the local containers storage. Throw an error if no image could be found. -- **newer**: Pull if the image on the registry is newer than the one in the local containers storage. An image is considered to be newer when the digests are different. Comparing the time stamps is prone to errors. Pull errors are suppressed if a local image was found. - -#### **--quiet**, **-q** - -Suppress output messages which indicate which instruction is being processed, -and of progress when pulling images from a registry, and when writing the -output image. - -#### **--rm** - -Remove intermediate containers after a successful build (default true). - -#### **--runtime**=*path* - -The *path* to an alternate OCI-compatible runtime, which will be used to run -commands specified by the **RUN** instruction. - -Note: You can also override the default runtime by setting the BUILDAH\_RUNTIME -environment variable. `export BUILDAH_RUNTIME=/usr/local/bin/runc` - -#### **--secret**=**id=id,src=path** - -Pass secret information to be used in the Containerfile for building images -in a safe way that will not end up stored in the final image, or be seen in other stages. -The secret will be mounted in the container at the default location of `/run/secrets/id`. - -To later use the secret, use the --mount option in a `RUN` instruction within a `Containerfile`: - -`RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret` - -#### **--security-opt**=*option* - -Security Options - -- `apparmor=unconfined` : Turn off apparmor confinement for the container -- `apparmor=your-profile` : Set the apparmor confinement profile for the -container - -- `label=user:USER` : Set the label user for the container processes -- `label=role:ROLE` : Set the label role for the container processes -- `label=type:TYPE` : Set the label process type for the container processes -- `label=level:LEVEL` : Set the label level for the container processes -- `label=filetype:TYPE` : Set the label file type for the container files -- `label=disable` : Turn off label separation for the container -- `no-new-privileges` : Not supported - -- `seccomp=unconfined` : Turn off seccomp confinement for the container -- `seccomp=profile.json` : White listed syscalls seccomp Json file to be used -as a seccomp filter - -#### **--shm-size**=*size* - -Size of `/dev/shm`. The format is ``. `number` must be greater -than `0`. -Unit is optional and can be `b` (bytes), `k` (kibibytes), `m`(mebibytes), or -`g` (gibibytes). If you omit the unit, the system uses bytes. If you omit the -size entirely, the system uses `64m`. - -#### **--sign-by**=*fingerprint* - -Sign the image using a GPG key with the specified FINGERPRINT. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines,) - -#### **--squash** - -Squash all of the image's new layers into a single new layer; any preexisting -layers are not squashed. - -#### **--squash-all** - -Squash all of the new image's layers (including those inherited from a base -image) into a single new layer. - -#### **--ssh**=*default* | *id[=socket>* - -SSH agent socket or keys to expose to the build. -The socket path can be left empty to use the value of `default=$SSH_AUTH_SOCK` - -To later use the ssh agent, use the --mount option in a `RUN` instruction within a `Containerfile`: - -`RUN --mount=type=ssh,id=id mycmd` - -#### **--stdin** - -Pass stdin into the RUN containers. Sometime commands being RUN within a Containerfile -want to request information from the user. For example apt asking for a confirmation for install. -Use --stdin to be able to interact from the terminal during the build. - -#### **--tag**, **-t**=*imageName* - -Specifies the name which will be assigned to the resulting image if the build -process completes successfully. -If _imageName_ does not include a registry name, the registry name *localhost* -will be prepended to the image name. - -#### **--target**=*stageName* - -Set the target build stage to build. When building a Containerfile with -multiple build stages, --target can be used to specify an intermediate build -stage by name as the final stage for the resulting image. Commands after the target stage will be skipped. - -#### **--timestamp**=*seconds* - -Set the create timestamp to seconds since epoch to allow for deterministic -builds (defaults to current time). By default, the created timestamp is changed -and written into the image manifest with every commit, causing the image's -sha256 hash to be different even if the sources are exactly the same otherwise. -When --timestamp is set, the created timestamp is always set to the time -specified and therefore not changed, allowing the image's sha256 hash to remain the -same. All files committed to the layers of the image will be created with the -timestamp. - -#### **--tls-verify** - -Require HTTPS and verify certificates when talking to container registries -(defaults to true). (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--ulimit**=*type=soft-limit[:hard-limit]* - -Specifies resource limits to apply to processes launched when processing `RUN` -instructions. This option can be specified multiple times. Recognized resource -types include: - "core": maximum core dump size (ulimit -c) - "cpu": maximum CPU time (ulimit -t) - "data": maximum size of a process's data segment (ulimit -d) - "fsize": maximum size of new files (ulimit -f) - "locks": maximum number of file locks (ulimit -x) - "memlock": maximum amount of locked memory (ulimit -l) - "msgqueue": maximum amount of data in message queues (ulimit -q) - "nice": niceness adjustment (nice -n, ulimit -e) - "nofile": maximum number of open files (ulimit -n) - "nproc": maximum number of processes (ulimit -u) - "rss": maximum size of a process's (ulimit -m) - "rtprio": maximum real-time scheduling priority (ulimit -r) - "rttime": maximum amount of real-time execution between blocking syscalls - "sigpending": maximum number of pending signals (ulimit -i) - "stack": maximum stack size (ulimit -s) - -#### **--unsetenv**=*env* - -Unset environment variables from the final image. - -#### **--userns**=*how* - -Sets the configuration for user namespaces when handling `RUN` instructions. -The configured value can be "" (the empty string) or "container" to indicate -that a new user namespace should be created, it can be "host" to indicate that -the user namespace in which `podman` itself is being run should be reused, or -it can be the path to a user namespace which is already in use by another -process. - -#### **--userns-gid-map**=*mapping* - -Directly specifies a GID mapping which should be used to set ownership, at the -filesystem level, on the working container's contents. -Commands run when handling `RUN` instructions will default to being run in -their own user namespaces, configured using the UID and GID maps. - -Entries in this map take the form of one or more triples of a starting -in-container GID, a corresponding starting host-level GID, and the number of -consecutive IDs which the map entry represents. - -This option overrides the *remap-gids* setting in the *options* section of -/etc/containers/storage.conf. - -If this option is not specified, but a global --userns-gid-map setting is -supplied, settings from the global option will be used. - -If none of --userns-uid-map-user, --userns-gid-map-group, or --userns-gid-map -are specified, but --userns-uid-map is specified, the GID map will be set to -use the same numeric values as the UID map. - -#### **--userns-gid-map-group**=*group* - -Specifies that a GID mapping which should be used to set ownership, at the -filesystem level, on the working container's contents, can be found in entries -in the `/etc/subgid` file which correspond to the specified group. -Commands run when handling `RUN` instructions will default to being run in -their own user namespaces, configured using the UID and GID maps. -If --userns-uid-map-user is specified, but --userns-gid-map-group is not -specified, `podman` will assume that the specified user name is also a -suitable group name to use as the default setting for this option. - -**NOTE:** When this option is specified by a rootless user, the specified -mappings are relative to the rootless user namespace in the container, rather -than being relative to the host as it would be when run rootful. - -#### **--userns-uid-map**=*mapping* - -Directly specifies a UID mapping which should be used to set ownership, at the -filesystem level, on the working container's contents. -Commands run when handling `RUN` instructions will default to being run in -their own user namespaces, configured using the UID and GID maps. - -Entries in this map take the form of one or more triples of a starting -in-container UID, a corresponding starting host-level UID, and the number of -consecutive IDs which the map entry represents. - -This option overrides the *remap-uids* setting in the *options* section of -/etc/containers/storage.conf. - -If this option is not specified, but a global --userns-uid-map setting is -supplied, settings from the global option will be used. - -If none of --userns-uid-map-user, --userns-gid-map-group, or --userns-uid-map -are specified, but --userns-gid-map is specified, the UID map will be set to -use the same numeric values as the GID map. - -#### **--userns-uid-map-user**=*user* - -Specifies that a UID mapping which should be used to set ownership, at the -filesystem level, on the working container's contents, can be found in entries -in the `/etc/subuid` file which correspond to the specified user. -Commands run when handling `RUN` instructions will default to being run in -their own user namespaces, configured using the UID and GID maps. -If --userns-gid-map-group is specified, but --userns-uid-map-user is not -specified, `podman` will assume that the specified group name is also a -suitable user name to use as the default setting for this option. - -**NOTE:** When this option is specified by a rootless user, the specified -mappings are relative to the rootless user namespace in the container, rather -than being relative to the host as it would be when run rootful. - -#### **--uts**=*how* - -Sets the configuration for UTS namespaces when handling `RUN` instructions. -The configured value can be "" (the empty string) or "container" to indicate -that a new UTS namespace should be created, or it can be "host" to indicate -that the UTS namespace in which `podman` itself is being run should be reused, -or it can be the path to a UTS namespace which is already in use by another -process. - -#### **--variant**=*variant* - -Set the architecture variant of the image to be built, and that of the base -image to be pulled, if the build uses one, to the provided value instead of -using the architecture variant of the build host. - -#### **--volume**, **-v**=*[HOST-DIR:CONTAINER-DIR[:OPTIONS]]* - -Create a bind mount. If you specify `-v /HOST-DIR:/CONTAINER-DIR`, Podman -bind mounts `/HOST-DIR` in the host to `/CONTAINER-DIR` in the Podman -container. (This option is not available with the remote Podman client, -including Mac and Windows (excluding WSL2) machines) - -The `OPTIONS` are a comma-separated list and can be: [[1]](#Footnote1) - - * [rw|ro] - * [z|Z|O] - * [U] - * [`[r]shared`|`[r]slave`|`[r]private`] - -The `CONTAINER-DIR` must be an absolute path such as `/src/docs`. The `HOST-DIR` -must be an absolute path as well. Podman bind-mounts the `HOST-DIR` to the -path you specify. For example, if you supply `/foo` as the host path, -Podman copies the contents of `/foo` to the container filesystem on the host -and bind mounts that into the container. - -You can specify multiple **-v** options to mount one or more mounts to a -container. - -You can add the `:ro` or `:rw` suffix to a volume to mount it read-only or -read-write mode, respectively. By default, the volumes are mounted read-write. -See examples. - - `Chowning Volume Mounts` - -By default, Podman does not change the owner and group of source volume -directories mounted. When running using user namespaces, the UID and GID inside -the namespace may correspond to another UID and GID on the host. - -The `:U` suffix tells Podman to use the correct host UID and GID based on the -UID and GID within the namespace, to change recursively the owner and group of -the source volume. - -**Warning** use with caution since this will modify the host filesystem. - - `Labeling Volume Mounts` - -Labeling systems like SELinux require that proper labels are placed on volume -content mounted into a container. Without a label, the security system might -prevent the processes running inside the container from using the content. By -default, Podman does not change the labels set by the OS. - -To change a label in the container context, you can add either of two suffixes -`:z` or `:Z` to the volume mount. These suffixes tell Podman to relabel file -objects on the shared volumes. The `z` option tells Podman that two containers -share the volume content. As a result, Podman labels the content with a shared -content label. Shared volume labels allow all containers to read/write content. -The `Z` option tells Podman to label the content with a private unshared label. -Only the current container can use a private volume. - -Note: Do not relabel system files and directories. Relabeling system content -might cause other confined services on your machine to fail. For these types -of containers, disabling SELinux separation is recommended. The option -`--security-opt label=disable` disables SELinux separation for the container. -For example, if a user wanted to volume mount their entire home directory into the build containers, they need to disable SELinux separation. - - $ podman build --security-opt label=disable -v $HOME:/home/user . - - `Overlay Volume Mounts` - - The `:O` flag tells Podman to mount the directory from the host as a -temporary storage using the Overlay file system. The `RUN` command containers -are allowed to modify contents within the mountpoint and are stored in the -container storage in a separate directory. In Overlay FS terms the source -directory will be the lower, and the container storage directory will be the -upper. Modifications to the mount point are destroyed when the `RUN` command -finishes executing, similar to a tmpfs mount point. - - Any subsequent execution of `RUN` commands sees the original source directory -content, any changes from previous RUN commands no longer exists. - - One use case of the `overlay` mount is sharing the package cache from the -host into the container to allow speeding up builds. - - Note: - - - Overlay mounts are not currently supported in rootless mode. - - The `O` flag is not allowed to be specified with the `Z` or `z` flags. -Content mounted into the container is labeled with the private label. - On SELinux systems, labels in the source directory needs to be readable -by the container label. If not, SELinux container separation must be disabled -for the container to work. - - Modification of the directory volume mounted into the container with an -overlay mount can cause unexpected failures. It is recommended that you do not -modify the directory until the container finishes running. - -By default bind mounted volumes are `private`. That means any mounts done -inside containers will not be visible on the host and vice versa. This behavior -can be changed by specifying a volume mount propagation property. - -When the mount propagation policy is set to `shared`, any mounts completed -inside the container on that volume will be visible to both the host and -container. When the mount propagation policy is set to `slave`, one way mount -propagation is enabled and any mounts completed on the host for that volume will -be visible only inside of the container. To control the mount propagation -property of volume use the `:[r]shared`, `:[r]slave` or `:[r]private` -propagation flag. For mount propagation to work on the source mount point (mount -point where source dir is mounted on) has to have the right propagation properties. -For shared volumes, the source mount point has to be shared. And for slave volumes, -the source mount has to be either shared or slave. [[1]](#Footnote1) - -Use `df ` to determine the source mount and then use -`findmnt -o TARGET,PROPAGATION ` to determine propagation -properties of source mount, if `findmnt` utility is not available, the source -mount point can be determined by looking at the mount entry in -`/proc/self/mountinfo`. Look at `optional fields` and see if any propagation -properties are specified. -`shared:X` means the mount is `shared`, `master:X` means the mount is `slave` -and if nothing is there that means the mount is `private`. [[1]](#Footnote1) - -To change propagation properties of a mount point use the `mount` command. For -example, to bind mount the source directory `/foo` do -`mount --bind /foo /foo` and `mount --make-private --make-shared /foo`. This -will convert /foo into a `shared` mount point. The propagation properties of -the source mount can be changed directly. For instance if `/` is the source -mount for `/foo`, then use `mount --make-shared /` to convert `/` into a -`shared` mount. - -## EXAMPLES - -### Build an image using local Containerfiles - -``` -$ podman build . - -$ podman build -f Containerfile.simple . - -$ cat $HOME/Containerfile | podman build -f - . - -$ podman build -f Containerfile.simple -f Containerfile.notsosimple . - -$ podman build -f Containerfile.in $HOME - -$ podman build -t imageName . - -$ podman build --tls-verify=true -t imageName -f Containerfile.simple . - -$ podman build --tls-verify=false -t imageName . - -$ podman build --runtime-flag log-format=json . - -$ podman build --runtime-flag debug . - -$ podman build --authfile /tmp/auths/myauths.json --cert-dir $HOME/auth --tls-verify=true --creds=username:password -t imageName -f Containerfile.simple . - -$ podman build --memory 40m --cpu-period 10000 --cpu-quota 50000 --ulimit nofile=1024:1028 -t imageName . - -$ podman build --security-opt label=level:s0:c100,c200 --cgroup-parent /path/to/cgroup/parent -t imageName . - -$ podman build --volume /home/test:/myvol:ro,Z -t imageName . - -$ podman build -v /var/lib/yum:/var/lib/yum:O -t imageName . - -$ podman build --layers -t imageName . - -$ podman build --no-cache -t imageName . - -$ podman build --layers --force-rm -t imageName . - -$ podman build --no-cache --rm=false -t imageName . - -$ podman build --network mynet . -``` - -### Building a multi-architecture image using the --manifest option (requires emulation software) - -``` -$ podman build --arch arm --manifest myimage /tmp/mysrc - -$ podman build --arch amd64 --manifest myimage /tmp/mysrc - -$ podman build --arch s390x --manifest myimage /tmp/mysrc - -$ podman build --platform linux/s390x,linux/ppc64le,linux/amd64 --manifest myimage /tmp/mysrc - -$ podman build --platform linux/arm64 --platform linux/amd64 --manifest myimage /tmp/mysrc -``` - -### Building an image using a URL, Git repo, or archive - - The build context directory can be specified as a URL to a Containerfile, a -Git repository, or URL to an archive. If the URL is a Containerfile, it is -downloaded to a temporary location and used as the context. When a Git -repository is set as the URL, the repository is cloned locally to a temporary -location and then used as the context. Lastly, if the URL is an archive, it is -downloaded to a temporary location and extracted before being used as the -context. - -#### Building an image using a URL to a Containerfile - - Podman will download the Containerfile to a temporary location and then use -it as the build context. - -``` -$ podman build https://10.10.10.1/podman/Containerfile -``` - -#### Building an image using a Git repository - - Podman will clone the specified GitHub repository to a temporary location and -use it as the context. The Containerfile at the root of the repository will be -used and it only works if the GitHub repository is a dedicated repository. - -``` -$ podman build git://github.com/scollier/purpletest -``` - -#### Building an image using a URL to an archive - - Podman will fetch the archive file, decompress it, and use its contents as the -build context. The Containerfile at the root of the archive and the rest of the -archive will get used as the context of the build. If you pass -`-f PATH/Containerfile` option as well, the system will look for that file -inside the contents of the archive. - -``` -$ podman build -f dev/Containerfile https://10.10.10.1/podman/context.tar.gz -``` - - Note: supported compression formats are 'xz', 'bzip2', 'gzip' and 'identity' -(no compression). - -## Files - -### .containerignore/.dockerignore - -If the file *.containerignore* or *.dockerignore* exists in the context directory, -`podman build` reads its contents. Use the `--ignorefile` option to override the -.containerignore path location. -Podman uses the content to exclude files and directories from the context -directory, when executing COPY and ADD directives in the -Containerfile/Dockerfile - -The .containerignore and .dockerignore files use the same syntax; if both -are in the context directory, podman build will only use .containerignore. - -Users can specify a series of Unix shell globs in a .containerignore file to -identify files/directories to exclude. - -Podman supports a special wildcard string `**` which matches any number of -directories (including zero). For example, **/*.go will exclude all files that -end with .go that are found in all directories. - -Example .containerignore file: - -``` -# exclude this content for image -*/*.c -**/output* -src -``` - -`*/*.c` -Excludes files and directories whose names ends with .c in any top level -subdirectory. For example, the source file include/rootless.c. - -`**/output*` -Excludes files and directories starting with `output` from any directory. - -`src` -Excludes files named src and the directory src as well as any content in it. - -Lines starting with ! (exclamation mark) can be used to make exceptions to -exclusions. The following is an example .containerignore file that uses this -mechanism: -``` -*.doc -!Help.doc -``` - -Exclude all doc files except Help.doc from the image. - -This functionality is compatible with the handling of .containerignore files -described here: - -https://github.com/containers/common/blob/main/docs/containerignore.5.md - -**registries.conf** (`/etc/containers/registries.conf`) - -registries.conf is the configuration file which specifies which container -registries should be consulted when completing image names which do not include -a registry or domain portion. - -## Troubleshooting - -### lastlog sparse file - -If you are using a useradd command within a Containerfile with a large UID/GID, -it will create a large sparse file `/var/log/lastlog`. This can cause the -build to hang forever. Go language does not support sparse files correctly, -which can lead to some huge files being created in your container image. - -If you are using `useradd` within your build script, you should pass the -`--no-log-init or -l` option to the `useradd` command. This option tells -useradd to stop creating the lastlog file. - -## SEE ALSO -**[podman(1)](podman.1.md)**, **[buildah(1)](https://github.com/containers/buildah/blob/main/docs/buildah.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)**, **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)**, **[crun(1)](https://github.com/containers/crun/blob/main/crun.1.md)**, **[runc(8)](https://github.com/opencontainers/runc/blob/master/man/runc.8.md)**, **[useradd(8)](https://www.unix.com/man-page/redhat/8/useradd)**, **[podman-ps(1)](podman-ps.1.md)**, **[podman-rm(1)](podman-rm.1.md)**, **[Containerfile(5)](https://github.com/containers/common/blob/main/docs/Containerfile.5.md)**, **[containerignore(5)](https://github.com/containers/common/blob/main/docs/containerignore.5.md)** - -## HISTORY -Aug 2020, Additional options and .containerignore added by Dan Walsh `` - -May 2018, Minor revisions added by Joe Doss `` - -December 2017, Originally compiled by Tom Sweeney `` - -## FOOTNOTES -1: 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. diff --git a/docs/source/markdown/podman-build.1.md.in b/docs/source/markdown/podman-build.1.md.in new file mode 100644 index 000000000..34282e2d2 --- /dev/null +++ b/docs/source/markdown/podman-build.1.md.in @@ -0,0 +1,1097 @@ +% podman-build(1) + +## NAME +podman\-build - Build a container image using a Containerfile + +## SYNOPSIS +**podman build** [*options*] [*context*] + +**podman image build** [*options*] [*context*] + +## DESCRIPTION +**podman build** Builds an image using instructions from one or more +Containerfiles or Dockerfiles and a specified build context directory. A +Containerfile uses the same syntax as a Dockerfile internally. For this +document, a file referred to as a Containerfile can be a file named +either 'Containerfile' or 'Dockerfile'. + +The build context directory can be specified as the http(s) URL of an archive, +git repository or Containerfile. + +If no context directory is specified, then Podman will assume the current +working directory as the build context, which should contain the Containerfile. + +Containerfiles ending with a ".in" suffix will be preprocessed via CPP(1). This +can be useful to decompose Containerfiles into several reusable parts that can +be used via CPP's **#include** directive. Notice, a Containerfile.in file can +still be used by other tools when manually preprocessing them via `cpp -E`. + +When the URL is an archive, the contents of the URL is downloaded to a temporary +location and extracted before execution. + +When the URL is a Containerfile, the Containerfile is downloaded to a temporary +location. + +When a Git repository is set as the URL, the repository is cloned locally and +then set as the context. + +NOTE: `podman build` uses code sourced from the `Buildah` project to build +container images. This `Buildah` code creates `Buildah` containers for the +`RUN` options in container storage. In certain situations, when the +`podman build` crashes or users kill the `podman build` process, these external +containers can be left in container storage. Use the `podman ps --all --storage` +command to see these containers. External containers can be removed with the +`podman rm --storage` command. + +`podman buildx build` command is an alias of `podman build`. Not all `buildx build` features are available in Podman. The `buildx build` option is provided for scripting compatibility. + +## OPTIONS + +@@option add-host + +#### **--all-platforms** + +Instead of building for a set of platforms specified using the **--platform** option, inspect the build's base images, and build for all of the platforms for which they are all available. Stages that use *scratch* as a starting point can not be inspected, so at least one non-*scratch* stage must be present for detection to work usefully. + +#### **--annotation**=*annotation* + +Add an image *annotation* (e.g. annotation=*value*) to the image metadata. Can +be used multiple times. + +Note: this information is not present in Docker image formats, so it is +discarded when writing images in Docker formats. + +#### **--arch**=*arch* + +Set the architecture of the image to be built, and that of the base image to be +pulled, if the build uses one, to the provided value instead of using the +architecture of the build host. (Examples: arm, arm64, 386, amd64, ppc64le, +s390x) + +#### **--authfile**=*path* + +Path of the authentication file. Default is +${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`. +If the authorization state is not found there, $HOME/.docker/config.json is +checked, which is set using `docker login`. + +Note: You can also override the default path of the authentication file by +setting the REGISTRY\_AUTH\_FILE environment variable. +`export REGISTRY_AUTH_FILE=path` + +#### **--build-arg**=*arg=value* + +Specifies a build argument and its value, which will be interpolated in +instructions read from the Containerfiles in the same way that environment +variables are, but which will not be added to environment variable list in the +resulting image's configuration. + +#### **--build-context**=*name=value* + +Specify an additional build context using its short name and its location. +Additional build contexts can be referenced in the same manner as we access +different stages in COPY instruction. + +Valid values could be: + +* Local directory – e.g. --build-context project2=../path/to/project2/src (This option is not available with the remote Podman client. On Podman machine setup (i.e macOS and Winows) path must exists on the machine VM) +* HTTP URL to a tarball – e.g. --build-context src=https://example.org/releases/src.tar +* Container image – specified with a container-image:// prefix, e.g. --build-context alpine=container-image://alpine:3.15, (also accepts docker://, docker-image://) + +On the Containerfile side, you can reference the build context on all +commands that accept the “from” parameter. Here’s how that might look: + +```dockerfile +FROM [name] +COPY --from=[name] ... +RUN --mount=from=[name] … +``` + +The value of [name] is matched with the following priority order: + +* Named build context defined with --build-context [name]=.. +* Stage defined with AS [name] inside Containerfile +* Image [name], either local or in a remote registry + +#### **--cache-from** + +Repository to utilize as a potential cache source. When specified, Buildah will try to look for +cache images in the specified repository and will attempt to pull cache images instead of actually +executing the build steps locally. Buildah will only attempt to pull previously cached images if they +are considered as valid cache hits. + +Use the `--cache-to` option to populate a remote repository with cache content. + +Example + +```bash +# populate a cache and also consult it +buildah build -t test --layers --cache-to registry/myrepo/cache --cache-from registry/myrepo/cache . +``` + +Note: `--cache-from` option is ignored unless `--layers` is specified. + +#### **--cache-to** + +Set this flag to specify a remote repository that will be used to store cache images. Buildah will attempt to +push newly built cache image to the remote repository. + +Note: Use the `--cache-from` option in order to use cache content in a remote repository. + +Example + +```bash +# populate a cache and also consult it +buildah build -t test --layers --cache-to registry/myrepo/cache --cache-from registry/myrepo/cache . +``` + +Note: `--cache-to` option is ignored unless `--layers` is specified. + +#### **--cache-ttl** + +Limit the use of cached images to only consider images with created timestamps less than *duration* ago. +For example if `--cache-ttl=1h` is specified, Buildah will only consider intermediate cache images which are created +under the duration of one hour, and intermediate cache images outside this duration will be ignored. + +#### **--cap-add**=*CAP\_xxx* + +When executing RUN instructions, run the command specified in the instruction +with the specified capability added to its capability set. +Certain capabilities are granted by default; this option can be used to add +more. + +#### **--cap-drop**=*CAP\_xxx* + +When executing RUN instructions, run the command specified in the instruction +with the specified capability removed from its capability set. +The CAP\_AUDIT\_WRITE, CAP\_CHOWN, CAP\_DAC\_OVERRIDE, CAP\_FOWNER, +CAP\_FSETID, CAP\_KILL, CAP\_MKNOD, CAP\_NET\_BIND\_SERVICE, CAP\_SETFCAP, +CAP\_SETGID, CAP\_SETPCAP, CAP\_SETUID, and CAP\_SYS\_CHROOT capabilities are +granted by default; this option can be used to remove them. + +If a capability is specified to both the **--cap-add** and **--cap-drop** +options, it will be dropped, regardless of the order in which the options were +given. + +#### **--cert-dir**=*path* + +Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry. (Default: /etc/containers/certs.d) +Please refer to containers-certs.d(5) for details. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +@@option cgroup-parent + +#### **--cgroupns**=*how* + +Sets the configuration for cgroup namespaces when handling `RUN` instructions. +The configured value can be "" (the empty string) or "private" to indicate +that a new cgroup namespace should be created, or it can be "host" to indicate +that the cgroup namespace in which `buildah` itself is being run should be reused. + +#### **--compress** + +This option is added to be aligned with other containers CLIs. +Podman doesn't communicate with a daemon or a remote server. +Thus, compressing the data before sending it is irrelevant to Podman. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +#### **--cpp-flag**=*flags* + +Set additional flags to pass to the C Preprocessor cpp(1). Containerfiles ending with a ".in" suffix will be preprocessed via cpp(1). This option can be used to pass additional flags to cpp.Note: You can also set default CPPFLAGS by setting the BUILDAH_CPPFLAGS environment variable (e.g., export BUILDAH_CPPFLAGS="-DDEBUG"). + +@@option cpu-period + +@@option cpu-quota + +@@option cpu-shares + +@@option cpuset-cpus + +@@option cpuset-mems + +#### **--creds**=*creds* + +The [username[:password]] to use to authenticate with the registry if required. +If one or both values are not supplied, a command line prompt will appear and +the value can be entered. The password is entered without echo. + +#### **--decryption-key**=*key[:passphrase]* + +The [key[:passphrase]] to be used for decryption of images. Key can point to +keys and/or certificates. Decryption will be tried with all keys. If the key is +protected by a passphrase, it is required to be passed in the argument and +omitted otherwise. + +#### **--device**=*host-device[:container-device][:permissions]* + +Add a host device to the container. Optional *permissions* parameter +can be used to specify device permissions, it is combination of +**r** for read, **w** for write, and **m** for **mknod**(2). + +Example: **--device=/dev/sdc:/dev/xvdc:rwm**. + +Note: if *host-device* is a symbolic link then it will be resolved first. +The container will only store the major and minor numbers of the host device. + +Note: if the user only has access rights via a group, accessing the device +from inside a rootless container will fail. The **[crun(1)](https://github.com/containers/crun/tree/main/crun.1.md)** runtime offers a +workaround for this by adding the option +**--annotation run.oci.keep_original_groups=1**. + +#### **--disable-compression**, **-D** + +Don't compress filesystem layers when building the image unless it is required +by the location where the image is being written. This is the default setting, +because image layers are compressed automatically when they are pushed to +registries, and images being written to local storage would only need to be +decompressed again to be stored. Compression can be forced in all cases by +specifying **--disable-compression=false**. + +#### **--disable-content-trust** + +This is a Docker specific option to disable image verification to a container +registry and is not supported by Podman. This option is a NOOP and provided +solely for scripting compatibility. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +#### **--dns**=*dns* + +Set custom DNS servers to be used during the build. + +This option can be used to override the DNS configuration passed to the +container. Typically this is necessary when the host DNS configuration is +invalid for the container (e.g., 127.0.0.1). When this is the case the `--dns` +option is necessary for every run. + +The special value **none** can be specified to disable creation of +/etc/resolv.conf in the container by Podman. The /etc/resolv.conf file in the +image will be used without changes. + +#### **--dns-option**=*option* + +Set custom DNS options to be used during the build. + +#### **--dns-search**=*domain* + +Set custom DNS search domains to be used during the build. + +#### **--env**=*env[=value]* + +Add a value (e.g. env=*value*) to the built image. Can be used multiple times. +If neither `=` nor a `*value*` are specified, but *env* is set in the current +environment, the value from the current environment will be added to the image. +To remove an environment variable from the built image, use the `--unsetenv` +option. + +#### **--file**, **-f**=*Containerfile* + +Specifies a Containerfile which contains instructions for building the image, +either a local file or an **http** or **https** URL. If more than one +Containerfile is specified, *FROM* instructions will only be accepted from the +first specified file. + +If a build context is not specified, and at least one Containerfile is a +local file, the directory in which it resides will be used as the build +context. + +If you specify `-f -`, the Containerfile contents will be read from stdin. + +#### **--force-rm** + +Always remove intermediate containers after a build, even if the build fails +(default true). + +#### **--format** + +Control the format for the built image's manifest and configuration data. +Recognized formats include *oci* (OCI image-spec v1.0, the default) and +*docker* (version 2, using schema format 2 for the manifest). + +Note: You can also override the default format by setting the BUILDAH\_FORMAT +environment variable. `export BUILDAH_FORMAT=docker` + +#### **--from** + +Overrides the first `FROM` instruction within the Containerfile. If there are multiple +FROM instructions in a Containerfile, only the first is changed. + +#### **--help**, **-h** + +Print usage statement + +#### **--http-proxy** + +Pass through HTTP Proxy environment variables. + +#### **--identity-label** + +Adds default identity label `io.buildah.version` if set. (default true). + +#### **--ignorefile** + +Path to an alternative .containerignore file. + +#### **--iidfile**=*ImageIDfile* + +Write the built image's ID to the file. When `--platform` is specified more +than once, attempting to use this option will trigger an error. + +#### **--ipc**=*how* + +Sets the configuration for IPC namespaces when handling `RUN` instructions. +The configured value can be "" (the empty string) or "container" to indicate +that a new IPC namespace should be created, or it can be "host" to indicate +that the IPC namespace in which `podman` itself is being run should be reused, +or it can be the path to an IPC namespace which is already in use by +another process. + +#### **--isolation**=*type* + +Controls what type of isolation is used for running processes as part of `RUN` +instructions. Recognized types include *oci* (OCI-compatible runtime, the +default), *rootless* (OCI-compatible runtime invoked using a modified +configuration and its --rootless option enabled, with *--no-new-keyring +--no-pivot* added to its *create* invocation, with network and UTS namespaces +disabled, and IPC, PID, and user namespaces enabled; the default for +unprivileged users), and *chroot* (an internal wrapper that leans more toward +chroot(1) than container technology). + +Note: You can also override the default isolation type by setting the +BUILDAH\_ISOLATION environment variable. `export BUILDAH_ISOLATION=oci` + +#### **--jobs**=*number* + +Run up to N concurrent stages in parallel. If the number of jobs is greater +than 1, stdin will be read from /dev/null. If 0 is specified, then there is +no limit in the number of jobs that run in parallel. + +#### **--label**=*label* + +Add an image *label* (e.g. label=*value*) to the image metadata. Can be used +multiple times. + +Users can set a special LABEL **io.containers.capabilities=CAP1,CAP2,CAP3** in +a Containerfile that specifies the list of Linux capabilities required for the +container to run properly. This label specified in a container image tells +Podman to run the container with just these capabilities. Podman launches the +container with just the specified capabilities, as long as this list of +capabilities is a subset of the default list. + +If the specified capabilities are not in the default set, Podman will +print an error message and will run the container with the default capabilities. + +#### **--layers** + +Cache intermediate images during the build process (Default is `true`). + +Note: You can also override the default value of layers by setting the +BUILDAH\_LAYERS environment variable. `export BUILDAH_LAYERS=true` + +#### **--logfile**=*filename* + +Log output which would be sent to standard output and standard error to the +specified file instead of to standard output and standard error. +This option is not supported on the remote client, including Mac and Windows +(excluding WSL2) machines. + +#### **--logsplit**=*bool-value* + +If `--logfile` and `--platform` are specified, the `--logsplit` option allows +end-users to split the log file for each platform into different files in the +following format: `${logfile}_${platform-os}_${platform-arch}`. +This option is not supported on the remote client, including Mac and Windows +(excluding WSL2) machines. + +#### **--manifest**=*manifest* + +Name of the manifest list to which the image will be added. Creates the manifest list +if it does not exist. This option is useful for building multi architecture images. + +#### **--memory**, **-m**=*LIMIT* + +Memory limit (format: `[]`, where unit = b (bytes), k (kibibytes), +m (mebibytes), or g (gibibytes)) + +Allows you to constrain the memory available to a container. If the host +supports swap memory, then the **-m** memory setting can be larger than physical +RAM. If a limit of 0 is specified (not using **-m**), the container's memory is +not limited. The actual limit may be rounded up to a multiple of the operating +system's page size (the value would be very large, that's millions of +trillions). + +#### **--memory-swap**=*LIMIT* + +A limit value equal to memory plus swap. Must be used with the **-m** +(**--memory**) option. The swap `LIMIT` should always be larger than **-m** +(**--memory**) value. By default, the swap `LIMIT` will be set to double +the value of --memory. + +The format of `LIMIT` is `[]`. Unit can be `b` (bytes), +`k` (kibibytes), `m` (mebibytes), or `g` (gibibytes). If you don't specify a +unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. + +#### **--network**=*mode*, **--net** + +Sets the configuration for network namespaces when handling `RUN` instructions. + +Valid _mode_ values are: + +- **none**: no networking. +- **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. +- **ns:**_path_: path to a network namespace to join. +- **private**: create a new namespace for the container (default) +- **\**: Join the network with the given name or ID, e.g. use `--network mynet` to join the network with the name mynet. Only supported for rootful users. + +#### **--no-cache** + +Do not use existing cached images for the container build. Build from the start +with a new set of cached layers. + +@@option no-hosts + +This option conflicts with **--add-host**. + +#### **--omit-history** + +Omit build history information in the built image. (default false). + +This option is useful for the cases where end users explicitly +want to set `--omit-history` to omit the optional `History` from +built images or when working with images built using build tools that +do not include `History` information in their images. + +#### **--os**=*string* + +Set the OS of the image to be built, and that of the base image to be pulled, +if the build uses one, instead of using the current operating system of the +build host. + +#### **--os-feature**=*feature* + +Set the name of a required operating system *feature* for the image which will +be built. By default, if the image is not based on *scratch*, the base image's +required OS feature list is kept, if the base image specified any. This option +is typically only meaningful when the image's OS is Windows. + +If *feature* has a trailing `-`, then the *feature* is removed from the set of +required features which will be listed in the image. + +#### **--os-version**=*version* + +Set the exact required operating system *version* for the image which will be +built. By default, if the image is not based on *scratch*, the base image's +required OS version is kept, if the base image specified one. This option is +typically only meaningful when the image's OS is Windows, and is typically set in +Windows base images, so using this option is usually unnecessary. + +#### **--output**, **-o**=*output-opts* + +Output destination (format: type=local,dest=path) + +The --output (or -o) option extends the default behavior of building a container image by allowing users to export the contents of the image as files on the local filesystem, which can be useful for generating local binaries, code generation, etc. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +The value for --output is a comma-separated sequence of key=value pairs, defining the output type and options. + +Supported _keys_ are: +- **dest**: Destination path for exported output. Valid value is absolute or relative path, `-` means the standard output. +- **type**: Defines the type of output to be used. Valid values is documented below. + +Valid _type_ values are: +- **local**: write the resulting build files to a directory on the client-side. +- **tar**: write the resulting files as a single tarball (.tar). + +If no type is specified, the value defaults to **local**. +Alternatively, instead of a comma-separated sequence, the value of **--output** can be just a destination (in the `**dest** format) (e.g. `--output some-path`, `--output -`) where `--output some-path` is treated as if **type=local** and `--output -` is treated as if **type=tar**. + +#### **--pid**=*pid* + +Sets the configuration for PID namespaces when handling `RUN` instructions. +The configured value can be "" (the empty string) or "container" to indicate +that a new PID namespace should be created, or it can be "host" to indicate +that the PID namespace in which `podman` itself is being run should be reused, +or it can be the path to a PID namespace which is already in use by another +process. + +#### **--platform**=*os/arch[/variant][,...]* + +Set the *os/arch* of the built image (and its base image, if your build uses one) +to the provided value instead of using the current operating system and +architecture of the host (for example `linux/arm`). If `--platform` is set, +then the values of the `--arch`, `--os`, and `--variant` options will be +overridden. + +The `--platform` option can be specified more than once, or given a +comma-separated list of values as its argument. When more than one platform is +specified, the `--manifest` option should be used instead of the `--tag` +option. + +Os/arch pairs are those used by the Go Programming Language. In several cases +the *arch* value for a platform differs from one produced by other tools such as +the `arch` command. Valid OS and architecture name combinations are listed as +values for $GOOS and $GOARCH at https://golang.org/doc/install/source#environment, +and can also be found by running `go tool dist list`. + +While `podman build` is happy to use base images and build images for any +platform that exists, `RUN` instructions will not be able to succeed without +the help of emulation provided by packages like `qemu-user-static`. + +#### **--pull**=*policy* + +Pull image policy. The default is **always**. + +- **always**, **true**: Always pull the image and throw an error if the pull fails. +- **missing**: Pull the image only if it could not be found in the local containers storage. Throw an error if no image could be found and the pull fails. +- **never**, **false**: Never pull the image but use the one from the local containers storage. Throw an error if no image could be found. +- **newer**: Pull if the image on the registry is newer than the one in the local containers storage. An image is considered to be newer when the digests are different. Comparing the time stamps is prone to errors. Pull errors are suppressed if a local image was found. + +#### **--quiet**, **-q** + +Suppress output messages which indicate which instruction is being processed, +and of progress when pulling images from a registry, and when writing the +output image. + +#### **--rm** + +Remove intermediate containers after a successful build (default true). + +#### **--runtime**=*path* + +The *path* to an alternate OCI-compatible runtime, which will be used to run +commands specified by the **RUN** instruction. + +Note: You can also override the default runtime by setting the BUILDAH\_RUNTIME +environment variable. `export BUILDAH_RUNTIME=/usr/local/bin/runc` + +#### **--secret**=**id=id,src=path** + +Pass secret information to be used in the Containerfile for building images +in a safe way that will not end up stored in the final image, or be seen in other stages. +The secret will be mounted in the container at the default location of `/run/secrets/id`. + +To later use the secret, use the --mount option in a `RUN` instruction within a `Containerfile`: + +`RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret` + +#### **--security-opt**=*option* + +Security Options + +- `apparmor=unconfined` : Turn off apparmor confinement for the container +- `apparmor=your-profile` : Set the apparmor confinement profile for the +container + +- `label=user:USER` : Set the label user for the container processes +- `label=role:ROLE` : Set the label role for the container processes +- `label=type:TYPE` : Set the label process type for the container processes +- `label=level:LEVEL` : Set the label level for the container processes +- `label=filetype:TYPE` : Set the label file type for the container files +- `label=disable` : Turn off label separation for the container +- `no-new-privileges` : Not supported + +- `seccomp=unconfined` : Turn off seccomp confinement for the container +- `seccomp=profile.json` : White listed syscalls seccomp Json file to be used +as a seccomp filter + +#### **--shm-size**=*size* + +Size of `/dev/shm`. The format is ``. `number` must be greater +than `0`. +Unit is optional and can be `b` (bytes), `k` (kibibytes), `m`(mebibytes), or +`g` (gibibytes). If you omit the unit, the system uses bytes. If you omit the +size entirely, the system uses `64m`. + +#### **--sign-by**=*fingerprint* + +Sign the image using a GPG key with the specified FINGERPRINT. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines,) + +#### **--squash** + +Squash all of the image's new layers into a single new layer; any preexisting +layers are not squashed. + +#### **--squash-all** + +Squash all of the new image's layers (including those inherited from a base +image) into a single new layer. + +#### **--ssh**=*default* | *id[=socket>* + +SSH agent socket or keys to expose to the build. +The socket path can be left empty to use the value of `default=$SSH_AUTH_SOCK` + +To later use the ssh agent, use the --mount option in a `RUN` instruction within a `Containerfile`: + +`RUN --mount=type=ssh,id=id mycmd` + +#### **--stdin** + +Pass stdin into the RUN containers. Sometime commands being RUN within a Containerfile +want to request information from the user. For example apt asking for a confirmation for install. +Use --stdin to be able to interact from the terminal during the build. + +#### **--tag**, **-t**=*imageName* + +Specifies the name which will be assigned to the resulting image if the build +process completes successfully. +If _imageName_ does not include a registry name, the registry name *localhost* +will be prepended to the image name. + +#### **--target**=*stageName* + +Set the target build stage to build. When building a Containerfile with +multiple build stages, --target can be used to specify an intermediate build +stage by name as the final stage for the resulting image. Commands after the target stage will be skipped. + +#### **--timestamp**=*seconds* + +Set the create timestamp to seconds since epoch to allow for deterministic +builds (defaults to current time). By default, the created timestamp is changed +and written into the image manifest with every commit, causing the image's +sha256 hash to be different even if the sources are exactly the same otherwise. +When --timestamp is set, the created timestamp is always set to the time +specified and therefore not changed, allowing the image's sha256 hash to remain the +same. All files committed to the layers of the image will be created with the +timestamp. + +#### **--tls-verify** + +Require HTTPS and verify certificates when talking to container registries +(defaults to true). (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +#### **--ulimit**=*type=soft-limit[:hard-limit]* + +Specifies resource limits to apply to processes launched when processing `RUN` +instructions. This option can be specified multiple times. Recognized resource +types include: + "core": maximum core dump size (ulimit -c) + "cpu": maximum CPU time (ulimit -t) + "data": maximum size of a process's data segment (ulimit -d) + "fsize": maximum size of new files (ulimit -f) + "locks": maximum number of file locks (ulimit -x) + "memlock": maximum amount of locked memory (ulimit -l) + "msgqueue": maximum amount of data in message queues (ulimit -q) + "nice": niceness adjustment (nice -n, ulimit -e) + "nofile": maximum number of open files (ulimit -n) + "nproc": maximum number of processes (ulimit -u) + "rss": maximum size of a process's (ulimit -m) + "rtprio": maximum real-time scheduling priority (ulimit -r) + "rttime": maximum amount of real-time execution between blocking syscalls + "sigpending": maximum number of pending signals (ulimit -i) + "stack": maximum stack size (ulimit -s) + +#### **--unsetenv**=*env* + +Unset environment variables from the final image. + +#### **--userns**=*how* + +Sets the configuration for user namespaces when handling `RUN` instructions. +The configured value can be "" (the empty string) or "container" to indicate +that a new user namespace should be created, it can be "host" to indicate that +the user namespace in which `podman` itself is being run should be reused, or +it can be the path to a user namespace which is already in use by another +process. + +#### **--userns-gid-map**=*mapping* + +Directly specifies a GID mapping which should be used to set ownership, at the +filesystem level, on the working container's contents. +Commands run when handling `RUN` instructions will default to being run in +their own user namespaces, configured using the UID and GID maps. + +Entries in this map take the form of one or more triples of a starting +in-container GID, a corresponding starting host-level GID, and the number of +consecutive IDs which the map entry represents. + +This option overrides the *remap-gids* setting in the *options* section of +/etc/containers/storage.conf. + +If this option is not specified, but a global --userns-gid-map setting is +supplied, settings from the global option will be used. + +If none of --userns-uid-map-user, --userns-gid-map-group, or --userns-gid-map +are specified, but --userns-uid-map is specified, the GID map will be set to +use the same numeric values as the UID map. + +#### **--userns-gid-map-group**=*group* + +Specifies that a GID mapping which should be used to set ownership, at the +filesystem level, on the working container's contents, can be found in entries +in the `/etc/subgid` file which correspond to the specified group. +Commands run when handling `RUN` instructions will default to being run in +their own user namespaces, configured using the UID and GID maps. +If --userns-uid-map-user is specified, but --userns-gid-map-group is not +specified, `podman` will assume that the specified user name is also a +suitable group name to use as the default setting for this option. + +**NOTE:** When this option is specified by a rootless user, the specified +mappings are relative to the rootless user namespace in the container, rather +than being relative to the host as it would be when run rootful. + +#### **--userns-uid-map**=*mapping* + +Directly specifies a UID mapping which should be used to set ownership, at the +filesystem level, on the working container's contents. +Commands run when handling `RUN` instructions will default to being run in +their own user namespaces, configured using the UID and GID maps. + +Entries in this map take the form of one or more triples of a starting +in-container UID, a corresponding starting host-level UID, and the number of +consecutive IDs which the map entry represents. + +This option overrides the *remap-uids* setting in the *options* section of +/etc/containers/storage.conf. + +If this option is not specified, but a global --userns-uid-map setting is +supplied, settings from the global option will be used. + +If none of --userns-uid-map-user, --userns-gid-map-group, or --userns-uid-map +are specified, but --userns-gid-map is specified, the UID map will be set to +use the same numeric values as the GID map. + +#### **--userns-uid-map-user**=*user* + +Specifies that a UID mapping which should be used to set ownership, at the +filesystem level, on the working container's contents, can be found in entries +in the `/etc/subuid` file which correspond to the specified user. +Commands run when handling `RUN` instructions will default to being run in +their own user namespaces, configured using the UID and GID maps. +If --userns-gid-map-group is specified, but --userns-uid-map-user is not +specified, `podman` will assume that the specified group name is also a +suitable user name to use as the default setting for this option. + +**NOTE:** When this option is specified by a rootless user, the specified +mappings are relative to the rootless user namespace in the container, rather +than being relative to the host as it would be when run rootful. + +#### **--uts**=*how* + +Sets the configuration for UTS namespaces when handling `RUN` instructions. +The configured value can be "" (the empty string) or "container" to indicate +that a new UTS namespace should be created, or it can be "host" to indicate +that the UTS namespace in which `podman` itself is being run should be reused, +or it can be the path to a UTS namespace which is already in use by another +process. + +#### **--variant**=*variant* + +Set the architecture variant of the image to be built, and that of the base +image to be pulled, if the build uses one, to the provided value instead of +using the architecture variant of the build host. + +#### **--volume**, **-v**=*[HOST-DIR:CONTAINER-DIR[:OPTIONS]]* + +Create a bind mount. If you specify `-v /HOST-DIR:/CONTAINER-DIR`, Podman +bind mounts `/HOST-DIR` in the host to `/CONTAINER-DIR` in the Podman +container. (This option is not available with the remote Podman client, +including Mac and Windows (excluding WSL2) machines) + +The `OPTIONS` are a comma-separated list and can be: [[1]](#Footnote1) + + * [rw|ro] + * [z|Z|O] + * [U] + * [`[r]shared`|`[r]slave`|`[r]private`] + +The `CONTAINER-DIR` must be an absolute path such as `/src/docs`. The `HOST-DIR` +must be an absolute path as well. Podman bind-mounts the `HOST-DIR` to the +path you specify. For example, if you supply `/foo` as the host path, +Podman copies the contents of `/foo` to the container filesystem on the host +and bind mounts that into the container. + +You can specify multiple **-v** options to mount one or more mounts to a +container. + +You can add the `:ro` or `:rw` suffix to a volume to mount it read-only or +read-write mode, respectively. By default, the volumes are mounted read-write. +See examples. + + `Chowning Volume Mounts` + +By default, Podman does not change the owner and group of source volume +directories mounted. When running using user namespaces, the UID and GID inside +the namespace may correspond to another UID and GID on the host. + +The `:U` suffix tells Podman to use the correct host UID and GID based on the +UID and GID within the namespace, to change recursively the owner and group of +the source volume. + +**Warning** use with caution since this will modify the host filesystem. + + `Labeling Volume Mounts` + +Labeling systems like SELinux require that proper labels are placed on volume +content mounted into a container. Without a label, the security system might +prevent the processes running inside the container from using the content. By +default, Podman does not change the labels set by the OS. + +To change a label in the container context, you can add either of two suffixes +`:z` or `:Z` to the volume mount. These suffixes tell Podman to relabel file +objects on the shared volumes. The `z` option tells Podman that two containers +share the volume content. As a result, Podman labels the content with a shared +content label. Shared volume labels allow all containers to read/write content. +The `Z` option tells Podman to label the content with a private unshared label. +Only the current container can use a private volume. + +Note: Do not relabel system files and directories. Relabeling system content +might cause other confined services on your machine to fail. For these types +of containers, disabling SELinux separation is recommended. The option +`--security-opt label=disable` disables SELinux separation for the container. +For example, if a user wanted to volume mount their entire home directory into the build containers, they need to disable SELinux separation. + + $ podman build --security-opt label=disable -v $HOME:/home/user . + + `Overlay Volume Mounts` + + The `:O` flag tells Podman to mount the directory from the host as a +temporary storage using the Overlay file system. The `RUN` command containers +are allowed to modify contents within the mountpoint and are stored in the +container storage in a separate directory. In Overlay FS terms the source +directory will be the lower, and the container storage directory will be the +upper. Modifications to the mount point are destroyed when the `RUN` command +finishes executing, similar to a tmpfs mount point. + + Any subsequent execution of `RUN` commands sees the original source directory +content, any changes from previous RUN commands no longer exists. + + One use case of the `overlay` mount is sharing the package cache from the +host into the container to allow speeding up builds. + + Note: + + - Overlay mounts are not currently supported in rootless mode. + - The `O` flag is not allowed to be specified with the `Z` or `z` flags. +Content mounted into the container is labeled with the private label. + On SELinux systems, labels in the source directory needs to be readable +by the container label. If not, SELinux container separation must be disabled +for the container to work. + - Modification of the directory volume mounted into the container with an +overlay mount can cause unexpected failures. It is recommended that you do not +modify the directory until the container finishes running. + +By default bind mounted volumes are `private`. That means any mounts done +inside containers will not be visible on the host and vice versa. This behavior +can be changed by specifying a volume mount propagation property. + +When the mount propagation policy is set to `shared`, any mounts completed +inside the container on that volume will be visible to both the host and +container. When the mount propagation policy is set to `slave`, one way mount +propagation is enabled and any mounts completed on the host for that volume will +be visible only inside of the container. To control the mount propagation +property of volume use the `:[r]shared`, `:[r]slave` or `:[r]private` +propagation flag. For mount propagation to work on the source mount point (mount +point where source dir is mounted on) has to have the right propagation properties. +For shared volumes, the source mount point has to be shared. And for slave volumes, +the source mount has to be either shared or slave. [[1]](#Footnote1) + +Use `df ` to determine the source mount and then use +`findmnt -o TARGET,PROPAGATION ` to determine propagation +properties of source mount, if `findmnt` utility is not available, the source +mount point can be determined by looking at the mount entry in +`/proc/self/mountinfo`. Look at `optional fields` and see if any propagation +properties are specified. +`shared:X` means the mount is `shared`, `master:X` means the mount is `slave` +and if nothing is there that means the mount is `private`. [[1]](#Footnote1) + +To change propagation properties of a mount point use the `mount` command. For +example, to bind mount the source directory `/foo` do +`mount --bind /foo /foo` and `mount --make-private --make-shared /foo`. This +will convert /foo into a `shared` mount point. The propagation properties of +the source mount can be changed directly. For instance if `/` is the source +mount for `/foo`, then use `mount --make-shared /` to convert `/` into a +`shared` mount. + +## EXAMPLES + +### Build an image using local Containerfiles + +``` +$ podman build . + +$ podman build -f Containerfile.simple . + +$ cat $HOME/Containerfile | podman build -f - . + +$ podman build -f Containerfile.simple -f Containerfile.notsosimple . + +$ podman build -f Containerfile.in $HOME + +$ podman build -t imageName . + +$ podman build --tls-verify=true -t imageName -f Containerfile.simple . + +$ podman build --tls-verify=false -t imageName . + +$ podman build --runtime-flag log-format=json . + +$ podman build --runtime-flag debug . + +$ podman build --authfile /tmp/auths/myauths.json --cert-dir $HOME/auth --tls-verify=true --creds=username:password -t imageName -f Containerfile.simple . + +$ podman build --memory 40m --cpu-period 10000 --cpu-quota 50000 --ulimit nofile=1024:1028 -t imageName . + +$ podman build --security-opt label=level:s0:c100,c200 --cgroup-parent /path/to/cgroup/parent -t imageName . + +$ podman build --volume /home/test:/myvol:ro,Z -t imageName . + +$ podman build -v /var/lib/yum:/var/lib/yum:O -t imageName . + +$ podman build --layers -t imageName . + +$ podman build --no-cache -t imageName . + +$ podman build --layers --force-rm -t imageName . + +$ podman build --no-cache --rm=false -t imageName . + +$ podman build --network mynet . +``` + +### Building a multi-architecture image using the --manifest option (requires emulation software) + +``` +$ podman build --arch arm --manifest myimage /tmp/mysrc + +$ podman build --arch amd64 --manifest myimage /tmp/mysrc + +$ podman build --arch s390x --manifest myimage /tmp/mysrc + +$ podman build --platform linux/s390x,linux/ppc64le,linux/amd64 --manifest myimage /tmp/mysrc + +$ podman build --platform linux/arm64 --platform linux/amd64 --manifest myimage /tmp/mysrc +``` + +### Building an image using a URL, Git repo, or archive + + The build context directory can be specified as a URL to a Containerfile, a +Git repository, or URL to an archive. If the URL is a Containerfile, it is +downloaded to a temporary location and used as the context. When a Git +repository is set as the URL, the repository is cloned locally to a temporary +location and then used as the context. Lastly, if the URL is an archive, it is +downloaded to a temporary location and extracted before being used as the +context. + +#### Building an image using a URL to a Containerfile + + Podman will download the Containerfile to a temporary location and then use +it as the build context. + +``` +$ podman build https://10.10.10.1/podman/Containerfile +``` + +#### Building an image using a Git repository + + Podman will clone the specified GitHub repository to a temporary location and +use it as the context. The Containerfile at the root of the repository will be +used and it only works if the GitHub repository is a dedicated repository. + +``` +$ podman build git://github.com/scollier/purpletest +``` + +#### Building an image using a URL to an archive + + Podman will fetch the archive file, decompress it, and use its contents as the +build context. The Containerfile at the root of the archive and the rest of the +archive will get used as the context of the build. If you pass +`-f PATH/Containerfile` option as well, the system will look for that file +inside the contents of the archive. + +``` +$ podman build -f dev/Containerfile https://10.10.10.1/podman/context.tar.gz +``` + + Note: supported compression formats are 'xz', 'bzip2', 'gzip' and 'identity' +(no compression). + +## Files + +### .containerignore/.dockerignore + +If the file *.containerignore* or *.dockerignore* exists in the context directory, +`podman build` reads its contents. Use the `--ignorefile` option to override the +.containerignore path location. +Podman uses the content to exclude files and directories from the context +directory, when executing COPY and ADD directives in the +Containerfile/Dockerfile + +The .containerignore and .dockerignore files use the same syntax; if both +are in the context directory, podman build will only use .containerignore. + +Users can specify a series of Unix shell globs in a .containerignore file to +identify files/directories to exclude. + +Podman supports a special wildcard string `**` which matches any number of +directories (including zero). For example, **/*.go will exclude all files that +end with .go that are found in all directories. + +Example .containerignore file: + +``` +# exclude this content for image +*/*.c +**/output* +src +``` + +`*/*.c` +Excludes files and directories whose names ends with .c in any top level +subdirectory. For example, the source file include/rootless.c. + +`**/output*` +Excludes files and directories starting with `output` from any directory. + +`src` +Excludes files named src and the directory src as well as any content in it. + +Lines starting with ! (exclamation mark) can be used to make exceptions to +exclusions. The following is an example .containerignore file that uses this +mechanism: +``` +*.doc +!Help.doc +``` + +Exclude all doc files except Help.doc from the image. + +This functionality is compatible with the handling of .containerignore files +described here: + +https://github.com/containers/common/blob/main/docs/containerignore.5.md + +**registries.conf** (`/etc/containers/registries.conf`) + +registries.conf is the configuration file which specifies which container +registries should be consulted when completing image names which do not include +a registry or domain portion. + +## Troubleshooting + +### lastlog sparse file + +If you are using a useradd command within a Containerfile with a large UID/GID, +it will create a large sparse file `/var/log/lastlog`. This can cause the +build to hang forever. Go language does not support sparse files correctly, +which can lead to some huge files being created in your container image. + +If you are using `useradd` within your build script, you should pass the +`--no-log-init or -l` option to the `useradd` command. This option tells +useradd to stop creating the lastlog file. + +## SEE ALSO +**[podman(1)](podman.1.md)**, **[buildah(1)](https://github.com/containers/buildah/blob/main/docs/buildah.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)**, **[containers-registries.conf(5)](https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md)**, **[crun(1)](https://github.com/containers/crun/blob/main/crun.1.md)**, **[runc(8)](https://github.com/opencontainers/runc/blob/master/man/runc.8.md)**, **[useradd(8)](https://www.unix.com/man-page/redhat/8/useradd)**, **[podman-ps(1)](podman-ps.1.md)**, **[podman-rm(1)](podman-rm.1.md)**, **[Containerfile(5)](https://github.com/containers/common/blob/main/docs/Containerfile.5.md)**, **[containerignore(5)](https://github.com/containers/common/blob/main/docs/containerignore.5.md)** + +## HISTORY +Aug 2020, Additional options and .containerignore added by Dan Walsh `` + +May 2018, Minor revisions added by Joe Doss `` + +December 2017, Originally compiled by Tom Sweeney `` + +## FOOTNOTES +1: 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. diff --git a/docs/source/markdown/podman-container-clone.1.md.in b/docs/source/markdown/podman-container-clone.1.md.in index 0b26e3479..cf760d7a2 100644 --- a/docs/source/markdown/podman-container-clone.1.md.in +++ b/docs/source/markdown/podman-container-clone.1.md.in @@ -15,93 +15,21 @@ podman\-container\-clone - Creates a copy of an existing container @@option blkio-weight-device -#### **--cpu-period**=*limit* - -Set the CPU period for the Completely Fair Scheduler (CFS), which is a -duration in microseconds. Once the container's CPU quota is used up, it will -not be scheduled to run until the current period ends. Defaults to 100000 -microseconds. - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error +@@option cpu-period If none is specified, the original container's cpu period is used -#### **--cpu-quota**=*limit* - -Limit the CPU Completely Fair Scheduler (CFS) quota. - -Limit the container's CPU usage. By default, containers run with the full -CPU resource. The limit is a number in microseconds. If a number is provided, -the container will be allowed to use that much CPU time until the CPU period -ends (controllable via **--cpu-period**). - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error +@@option cpu-quota If none is specified, the original container's CPU quota are used. -#### **--cpu-rt-period**=*microseconds* - -Limit the CPU real-time period in microseconds - -Limit the container's Real Time CPU usage. This option tells the kernel to restrict the container's Real Time CPU usage to the period specified. - -This option is not supported on cgroups V2 systems. +@@option cpu-rt-period If none is specified, the original container's CPU runtime period is used. +@@option cpu-rt-runtime -#### **--cpu-rt-runtime**=*microseconds* - -Limit the CPU real-time runtime in microseconds. - -Limit the containers Real Time CPU usage. This option tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex: -Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks. - -The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. - -This option is not supported on cgroups V2 systems. - -#### **--cpu-shares**, **-c**=*shares* - -CPU shares (relative weight) - -By default, all containers get the same proportion of CPU cycles. This proportion -can be modified by changing the container's CPU share weighting relative -to the weighting of all other running containers. - -To modify the proportion from the default of 1024, use the **--cpu-shares** -option to set the weighting to 2 or higher. - -The proportion will only apply when CPU-intensive processes are running. -When tasks in one container are idle, other containers can use the -left-over CPU time. The actual amount of CPU time will vary depending on -the number of containers running on the system. - -For example, consider three containers, one has a cpu-share of 1024 and -two others have a cpu-share setting of 512. When processes in all three -containers attempt to use 100% of CPU, the first container would receive -50% of the total CPU time. If a fourth container is added with a cpu-share -of 1024, the first container only gets 33% of the CPU. The remaining containers -receive 16.5%, 16.5% and 33% of the CPU. - -On a multi-core system, the shares of CPU time are distributed over all CPU -cores. Even if a container is limited to less than 100% of CPU time, it can -use 100% of each individual CPU core. - -For example, consider a system with more than three cores. -If the container _C0_ is started with **--cpu-shares=512** running one process, -and another container _C1_ with **--cpu-shares=1024** running two processes, -this can result in the following division of CPU shares: - -| PID | container | CPU | CPU share | -| ---- | ----------- | ------- | ------------ | -| 100 | C0 | 0 | 100% of CPU0 | -| 101 | C1 | 1 | 100% of CPU1 | -| 102 | C1 | 2 | 100% of CPU2 | +@@option cpu-shares If none are specified, the original container's CPU shares are used. @@ -112,17 +40,11 @@ Set a number of CPUs for the container that overrides the original containers CP This is shorthand for **--cpu-period** and **--cpu-quota**, so only **--cpus** or either both the **--cpu-period** and **--cpu-quota** options can be set. -#### **--cpuset-cpus** - -CPUs in which to allow execution (0-3, 0,1). If none are specified, the original container's CPUset is used. - -#### **--cpuset-mems**=*nodes* +@@option cpuset-cpus -Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. +If none are specified, the original container's CPUset is used. -If there are four memory nodes on the system (0-3), use `--cpuset-mems=0,1` -then processes in the container will only use memory from the first -two memory nodes. +@@option cpuset-mems If none are specified, the original container's CPU memory nodes are used. diff --git a/docs/source/markdown/podman-create.1.md.in b/docs/source/markdown/podman-create.1.md.in index aa9116c4a..5bb1dceca 100644 --- a/docs/source/markdown/podman-create.1.md.in +++ b/docs/source/markdown/podman-create.1.md.in @@ -66,12 +66,7 @@ and specified with a _tag_. ## OPTIONS -#### **--add-host**=*host* - -Add a custom host-to-IP mapping (host:ip) - -Add a line to /etc/hosts. The format is hostname:ip. The **--add-host** -option can be set multiple times. +@@option add-host #### **--annotation**=*key=value* @@ -111,29 +106,11 @@ Block IO relative device weight. @@option cgroup-conf -#### **--cgroup-parent**=*path* - -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. - -#### **--cgroupns**=*mode* - -Set the cgroup namespace mode for the container. - **`host`**: use the host's cgroup namespace inside the container. - **`container:`**: join the namespace of the specified container. - **`ns:`**: join the namespace at the specified path. - **`private`**: create a new cgroup namespace. +@@option cgroup-parent -If the host uses cgroups v1, the default is set to **host**. On cgroups v2 the default is **private**. +@@option cgroupns -#### **--cgroups**=*mode* - -Determines whether the container will create CGroups. -Valid values are *enabled*, *disabled*, *no-conmon*, *split*, with the default being *enabled*. - -The *enabled* option will create a new cgroup under the cgroup-parent. -The *disabled* option will force the container to not create CGroups, and thus conflicts with CGroup options (**--cgroupns** and **--cgroup-parent**). -The *no-conmon* option disables a new CGroup only for the conmon process. -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*. +@@option cgroups @@option chrootdirs @@ -141,91 +118,17 @@ The *split* option splits the current cgroup in two sub-cgroups: one for conmon Write the container ID to the file -#### **--conmon-pidfile**=*path* - -Write the pid of the `conmon` process to a file. `conmon` runs in a separate process than Podman, so this is necessary when using systemd to restart Podman containers. -(This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) +@@option conmon-pidfile -#### **--cpu-period**=*limit* +@@option cpu-period -Set the CPU period for the Completely Fair Scheduler (CFS), which is a -duration in microseconds. Once the container's CPU quota is used up, it will -not be scheduled to run until the current period ends. Defaults to 100000 -microseconds. - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error - -#### **--cpu-quota**=*limit* - -Limit the CPU Completely Fair Scheduler (CFS) quota. - -Limit the container's CPU usage. By default, containers run with the full -CPU resource. The limit is a number in microseconds. If you provide a number, -the container will be allowed to use that much CPU time until the CPU period -ends (controllable via **--cpu-period**). - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error +@@option cpu-quota -#### **--cpu-rt-period**=*microseconds* +@@option cpu-rt-period -Limit the CPU real-time period in microseconds +@@option cpu-rt-runtime -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. - -This flag is not supported on cgroups V2 systems. - -#### **--cpu-rt-runtime**=*microseconds* - -Limit the CPU real-time runtime in microseconds - -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: -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. - -The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. - -This flag is not supported on cgroups V2 systems. - -#### **--cpu-shares**, **-c**=*shares* - -CPU shares (relative weight) - -By default, all containers get the same proportion of CPU cycles. This proportion -can be modified by changing the container's CPU share weighting relative -to the weighting of all other running containers. - -To modify the proportion from the default of 1024, use the **--cpu-shares** -flag to set the weighting to 2 or higher. - -The proportion will only apply when CPU-intensive processes are running. -When tasks in one container are idle, other containers can use the -left-over CPU time. The actual amount of CPU time will vary depending on -the number of containers running on the system. - -For example, consider three containers, one has a cpu-share of 1024 and -two others have a cpu-share setting of 512. When processes in all three -containers attempt to use 100% of CPU, the first container would receive -50% of the total CPU time. If you add a fourth container with a cpu-share -of 1024, the first container only gets 33% of the CPU. The remaining containers -receive 16.5%, 16.5% and 33% of the CPU. - -On a multi-core system, the shares of CPU time are distributed over all CPU -cores. Even if a container is limited to less than 100% of CPU time, it can -use 100% of each individual CPU core. - -For example, consider a system with more than three cores. -If the container _C0_ is started with **--cpu-shares=512** running one process, -and another container _C1_ with **--cpu-shares=1024** running two processes, -this can result in the following division of CPU shares: - -| PID | container | CPU | CPU share | -| ---- | ----------- | ------- | ------------ | -| 100 | C0 | 0 | 100% of CPU0 | -| 101 | C1 | 1 | 100% of CPU1 | -| 102 | C1 | 2 | 100% of CPU2 | +@@option cpu-shares #### **--cpus**=*number* @@ -237,17 +140,9 @@ On some systems, changing the CPU limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error -#### **--cpuset-cpus**=*cpus* - -CPUs in which to allow execution (0-3, 0,1) - -#### **--cpuset-mems**=*nodes* - -Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. +@@option cpuset-cpus -If you have four memory nodes on your system (0-3), use `--cpuset-mems=0,1` -then processes in your container will only use memory from the first -two memory nodes. +@@option cpuset-mems #### **--device**=*host-device[:container-device][:permissions]* @@ -556,11 +451,8 @@ Valid _mode_ values are: @@option no-healthcheck -#### **--no-hosts** +@@option no-hosts -Do not create _/etc/hosts_ for the container. -By default, Podman will manage _/etc/hosts_, adding the container's own IP address and any hosts from **--add-host**. -**--no-hosts** disables this, and the image's _/etc/hosts_ will be preserved unmodified. This option conflicts with **--add-host**. @@option oom-kill-disable diff --git a/docs/source/markdown/podman-kube-play.1.md b/docs/source/markdown/podman-kube-play.1.md deleted file mode 100644 index b3c385fe9..000000000 --- a/docs/source/markdown/podman-kube-play.1.md +++ /dev/null @@ -1,329 +0,0 @@ -% podman-kube-play(1) - -## NAME -podman-kube-play - Create containers, pods and volumes based on Kubernetes YAML - -## SYNOPSIS -**podman kube play** [*options*] *file.yml|-* - -## DESCRIPTION -**podman kube play** will read in a structured file of Kubernetes YAML. It will then recreate the containers, pods or volumes described in the YAML. Containers within a pod are then started and the ID of the new Pod or the name of the new Volume is output. If the yaml file is specified as "-" then `podman kube play` will read the YAML file from stdin. -Using the `--down` command line option, it is also capable of tearing down the pods created by a previous run of `podman kube play`. -Using the `--replace` command line option, it will tear down the pods(if any) created by a previous run of `podman kube play` and recreate the pods with the Kubernetes YAML file. -Ideally the input file would be one created by Podman (see podman-generate-kube(1)). This would guarantee a smooth import and expected results. - -Currently, the supported Kubernetes kinds are: -- Pod -- Deployment -- PersistentVolumeClaim -- ConfigMap - -`Kubernetes Pods or Deployments` - -Only two volume types are supported by kube play, the *hostPath* and *persistentVolumeClaim* volume types. For the *hostPath* volume type, only the *default (empty)*, *DirectoryOrCreate*, *Directory*, *FileOrCreate*, *File*, *Socket*, *CharDevice* and *BlockDevice* subtypes are supported. Podman interprets the value of *hostPath* *path* as a file path when it contains at least one forward slash, otherwise Podman treats the value as the name of a named volume. When using a *persistentVolumeClaim*, the value for *claimName* is the name for the Podman named volume. - -Note: When playing a kube YAML with init containers, the init container will be created with init type value `once`. To change the default type, use the `io.podman.annotations.init.container.type` annotation to set the type to `always`. - -Note: *hostPath* volume types created by kube play will be given an SELinux shared label (z), bind mounts are not relabeled (use `chcon -t container_file_t -R `). - -Note: If the `:latest` tag is used, Podman will attempt to pull the image from a registry. If the image was built locally with Podman or Buildah, it will have `localhost` as the domain, in that case, Podman will use the image from the local store even if it has the `:latest` tag. - -Note: The command `podman play kube` is an alias of `podman kube play`, and will perform the same function. - -Note: The command `podman kube down` can be used to stop and remove pods or containers based on the same Kubernetes YAML used -by `podman kube play` to create them. - -`Kubernetes PersistentVolumeClaims` - -A Kubernetes PersistentVolumeClaim represents a Podman named volume. Only the PersistentVolumeClaim name is required by Podman to create a volume. Kubernetes annotations can be used to make use of the available options for Podman volumes. - -- volume.podman.io/driver -- volume.podman.io/device -- volume.podman.io/type -- volume.podman.io/uid -- volume.podman.io/gid -- volume.podman.io/mount-options - -Kube play is capable of building images on the fly given the correct directory layout and Containerfiles. This -option is not available for remote clients, including Mac and Windows (excluding WSL2) machines, yet. Consider the following excerpt from a YAML file: -``` -apiVersion: v1 -kind: Pod -metadata: -... -spec: - containers: - - command: - - top - - name: container - value: podman - image: foobar -... -``` - -If there is a directory named `foobar` in the current working directory with a file named `Containerfile` or `Dockerfile`, -Podman kube play will build that image and name it `foobar`. An example directory structure for this example would look -like: -``` -|- mykubefiles - |- myplayfile.yaml - |- foobar - |- Containerfile -``` - -The build will consider `foobar` to be the context directory for the build. If there is an image in local storage -called `foobar`, the image will not be built unless the `--build` flag is used. Use `--build=false` to completely -disable builds. - -`Kubernetes ConfigMap` - -Kubernetes ConfigMap can be referred as a source of environment variables or volumes in Pods or Deployments. -ConfigMaps aren't a standalone object in Podman; instead, when a container uses a ConfigMap, Podman will create environment variables or volumes as needed. - -For example, the following YAML document defines a ConfigMap and then uses it in a Pod: - -``` -apiVersion: v1 -kind: ConfigMap -metadata: - name: foo -data: - FOO: bar ---- -apiVersion: v1 -kind: Pod -metadata: - name: foobar -spec: - containers: - - command: - - top - name: container-1 - image: foobar - envFrom: - - configMapRef: - name: foo - optional: false -``` - -and as a result environment variable `FOO` will be set to `bar` for container `container-1`. - -## OPTIONS - -#### **--annotation**=*key=value* - -Add an annotation to the container or pod. The format is key=value. -The **--annotation** option can be set multiple times. - -#### **--authfile**=*path* - -Path of the authentication file. Default is ${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`. -If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`. - -Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE -environment variable. `export REGISTRY_AUTH_FILE=path` - -#### **--build** - -Build images even if they are found in the local storage. Use `--build=false` to completely disable builds. (This option is not available with the remote Podman client) - -#### **--cert-dir**=*path* - -Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry. (Default: /etc/containers/certs.d) -Please refer to containers-certs.d(5) for details. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--configmap**=*path* - -Use Kubernetes configmap YAML at path to provide a source for environment variable values within the containers of the pod. (This option is not available with the remote Podman client) - -Note: The *--configmap* option can be used multiple times or a comma-separated list of paths can be used to pass multiple Kubernetes configmap YAMLs. - -#### **--context-dir**=*path* - -Use *path* as the build context directory for each image. Requires --build option be true. (This option is not available with the remote Podman client) - -#### **--creds** - -The [username[:password]] to use to authenticate with the registry if required. -If one or both values are not supplied, a command line prompt will appear and the -value can be entered. The password is entered without echo. - -#### **--help**, **-h** - -Print usage statement - -#### **--ip**=*IP address* - -Assign a static ip address to the pod. This option can be specified several times when kube play creates more than one pod. -Note: When joining multiple networks you should use the **--network name:ip=\** syntax. - -#### **--log-driver**=*driver* - -Set logging driver for all created containers. - -#### **--log-opt**=*name=value* - -Set custom logging configuration. The following *name*s are supported: - -- **path**: specify a path to the log file -(e.g. **--log-opt path=/var/log/container/mycontainer.json**); - -- **max-size**: specify a max size of the log file -(e.g. **--log-opt max-size=10mb**); - -- **tag**: specify a custom log tag for the container -(e.g. **--log-opt tag="{{.ImageName}}"**. - -It supports the same keys as **podman inspect --format**. - -This option is currently supported only by the **journald** log driver. - -#### **--mac-address**=*MAC address* - -Assign a static mac address to the pod. This option can be specified several times when kube play creates more than one pod. -Note: When joining multiple networks you should use the **--network name:mac=\** syntax. - -#### **--network**=*mode*, **--net** - -Change the network mode of the pod. The host network mode should be configured in the YAML file. -Valid _mode_ values are: - -- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options: - - **alias=name**: Add network-scoped alias for the container. - - **ip=IPv4**: Specify a static ipv4 address for this container. - - **ip=IPv6**: Specify a static ipv6 address for this container. - - **mac=MAC**: Specify a static mac address for this container. - - **interface_name**: Specify a name for the created network interface inside the container. - - For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`. -- \[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks. -- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity. -- **container:**_id_: Reuse another container's network stack. -- **ns:**_path_: Path to a network namespace to join. -- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones. -- **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, they can also be set with `network_cmd_options` in containers.conf: - - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`). Default is false. - - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`). - - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`). - - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`). - - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only). - - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to. - - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only). - - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to. - - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default. - Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks. - - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks. - -#### **--no-hosts** - -Do not create /etc/hosts for the pod. -By default, Podman will manage /etc/hosts, adding the container's own IP address and any hosts from **--add-host**. -**--no-hosts** disables this, and the image's **/etc/host** will be preserved unmodified. -This option conflicts with host added in the Kubernetes YAML. - -#### **--quiet**, **-q** - -Suppress output information when pulling images - -#### **--replace** - -Tears down the pods created by a previous run of `kube play` and recreates the pods. This option is used to keep the existing pods up to date based upon the Kubernetes YAML. - -#### **--seccomp-profile-root**=*path* - -Directory path for seccomp profiles (default: "/var/lib/kubelet/seccomp"). (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--start** - -Start the pod after creating it, set to false to only create it. - -#### **--tls-verify** - -Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true, -then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified, -TLS verification will be used unless the target registry is listed as an insecure registry in registries.conf. - -#### **--userns**=*mode* - -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 the **--uidmap** and **--gidmap** options. - -Rootless user --userns=Key mappings: - -Key | Host User | Container User -----------|---------------|--------------------- -"" |$UID |0 (Default User account mapped to root user in container.) -keep-id |$UID |$UID (Map user account to same UID within container.) -auto |$UID | nil (Host User UID is not mapped into container.) -nomap |$UID | nil (Host User UID is not mapped into container.) - -Valid _mode_ values are: - -**auto**[:_OPTIONS,..._]: automatically create a unique user namespace. - -The `--userns=auto` flag, requires that the user name `containers` and a range of subordinate user ids that the Podman container is allowed to use be specified in the /etc/subuid and /etc/subgid files. - -Example: `containers:2147483647:2147483648`. - -Podman allocates unique ranges of UIDs and GIDs from the `containers` subordinate user ids. The size of the ranges is based on the number of UIDs required in the image. The number of UIDs and GIDs can be overridden with the `size` option. The `auto` options currently does not work in rootless mode - - Valid `auto` options: - - - *gidmapping*=_CONTAINER_GID:HOST_GID:SIZE_: to force a GID mapping to be present in the user namespace. - - *size*=_SIZE_: to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will estimate a size for the user namespace. - - *uidmapping*=_CONTAINER_UID:HOST_UID:SIZE_: to force a UID mapping to be present in the user namespace. - -**container:**_id_: join the user namespace of the specified container. - -**host**: create a new namespace for the container. - -**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 not allowed for containers created by the root user. - -**nomap**: creates a user namespace where the current rootless user's UID:GID are not mapped into the container. This option is not allowed for containers created by the root user. - -**ns:**_namespace_: run the pod in the given existing user namespace. - -## EXAMPLES - -Recreate the pod and containers as described in a file called `demo.yml` -``` -$ podman kube play demo.yml -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 -``` - -Recreate the pod and containers as described in a file `demo.yml` sent to stdin -``` -$ cat demo.yml | podman kube play - -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 - -``` -Teardown the pod and containers as described in a file `demo.yml` -``` -$ podman kube play --down demo.yml -Pods stopped: -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 -Pods removed: -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 -``` - -Provide `configmap-foo.yml` and `configmap-bar.yml` as sources for environment variables within the containers. -``` -$ podman kube play demo.yml --configmap configmap-foo.yml,configmap-bar.yml -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 - -$ podman kube play demo.yml --configmap configmap-foo.yml --configmap configmap-bar.yml -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 -``` - -Create a pod connected to two networks (called net1 and net2) with a static ip -``` -$ podman kube play demo.yml --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10 -52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 -``` - -Please take into account that networks must be created first using podman-network-create(1). - -## SEE ALSO -**[podman(1)](podman.1.md)**, **[podman-kube(1)](podman-kube.1.md)**, **[podman-kube-down(1)](podman-kube-down.1.md)**, **[podman-network-create(1)](podman-network-create.1.md)**, **[podman-generate-kube(1)](podman-generate-kube.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)** - -## HISTORY -December 2018, Originally compiled by Brent Baude (bbaude at redhat dot com) diff --git a/docs/source/markdown/podman-kube-play.1.md.in b/docs/source/markdown/podman-kube-play.1.md.in new file mode 100644 index 000000000..9e9fc7f38 --- /dev/null +++ b/docs/source/markdown/podman-kube-play.1.md.in @@ -0,0 +1,326 @@ +% podman-kube-play(1) + +## NAME +podman-kube-play - Create containers, pods and volumes based on Kubernetes YAML + +## SYNOPSIS +**podman kube play** [*options*] *file.yml|-* + +## DESCRIPTION +**podman kube play** will read in a structured file of Kubernetes YAML. It will then recreate the containers, pods or volumes described in the YAML. Containers within a pod are then started and the ID of the new Pod or the name of the new Volume is output. If the yaml file is specified as "-" then `podman kube play` will read the YAML file from stdin. +Using the `--down` command line option, it is also capable of tearing down the pods created by a previous run of `podman kube play`. +Using the `--replace` command line option, it will tear down the pods(if any) created by a previous run of `podman kube play` and recreate the pods with the Kubernetes YAML file. +Ideally the input file would be one created by Podman (see podman-generate-kube(1)). This would guarantee a smooth import and expected results. + +Currently, the supported Kubernetes kinds are: +- Pod +- Deployment +- PersistentVolumeClaim +- ConfigMap + +`Kubernetes Pods or Deployments` + +Only two volume types are supported by kube play, the *hostPath* and *persistentVolumeClaim* volume types. For the *hostPath* volume type, only the *default (empty)*, *DirectoryOrCreate*, *Directory*, *FileOrCreate*, *File*, *Socket*, *CharDevice* and *BlockDevice* subtypes are supported. Podman interprets the value of *hostPath* *path* as a file path when it contains at least one forward slash, otherwise Podman treats the value as the name of a named volume. When using a *persistentVolumeClaim*, the value for *claimName* is the name for the Podman named volume. + +Note: When playing a kube YAML with init containers, the init container will be created with init type value `once`. To change the default type, use the `io.podman.annotations.init.container.type` annotation to set the type to `always`. + +Note: *hostPath* volume types created by kube play will be given an SELinux shared label (z), bind mounts are not relabeled (use `chcon -t container_file_t -R `). + +Note: If the `:latest` tag is used, Podman will attempt to pull the image from a registry. If the image was built locally with Podman or Buildah, it will have `localhost` as the domain, in that case, Podman will use the image from the local store even if it has the `:latest` tag. + +Note: The command `podman play kube` is an alias of `podman kube play`, and will perform the same function. + +Note: The command `podman kube down` can be used to stop and remove pods or containers based on the same Kubernetes YAML used +by `podman kube play` to create them. + +`Kubernetes PersistentVolumeClaims` + +A Kubernetes PersistentVolumeClaim represents a Podman named volume. Only the PersistentVolumeClaim name is required by Podman to create a volume. Kubernetes annotations can be used to make use of the available options for Podman volumes. + +- volume.podman.io/driver +- volume.podman.io/device +- volume.podman.io/type +- volume.podman.io/uid +- volume.podman.io/gid +- volume.podman.io/mount-options + +Kube play is capable of building images on the fly given the correct directory layout and Containerfiles. This +option is not available for remote clients, including Mac and Windows (excluding WSL2) machines, yet. Consider the following excerpt from a YAML file: +``` +apiVersion: v1 +kind: Pod +metadata: +... +spec: + containers: + - command: + - top + - name: container + value: podman + image: foobar +... +``` + +If there is a directory named `foobar` in the current working directory with a file named `Containerfile` or `Dockerfile`, +Podman kube play will build that image and name it `foobar`. An example directory structure for this example would look +like: +``` +|- mykubefiles + |- myplayfile.yaml + |- foobar + |- Containerfile +``` + +The build will consider `foobar` to be the context directory for the build. If there is an image in local storage +called `foobar`, the image will not be built unless the `--build` flag is used. Use `--build=false` to completely +disable builds. + +`Kubernetes ConfigMap` + +Kubernetes ConfigMap can be referred as a source of environment variables or volumes in Pods or Deployments. +ConfigMaps aren't a standalone object in Podman; instead, when a container uses a ConfigMap, Podman will create environment variables or volumes as needed. + +For example, the following YAML document defines a ConfigMap and then uses it in a Pod: + +``` +apiVersion: v1 +kind: ConfigMap +metadata: + name: foo +data: + FOO: bar +--- +apiVersion: v1 +kind: Pod +metadata: + name: foobar +spec: + containers: + - command: + - top + name: container-1 + image: foobar + envFrom: + - configMapRef: + name: foo + optional: false +``` + +and as a result environment variable `FOO` will be set to `bar` for container `container-1`. + +## OPTIONS + +#### **--annotation**=*key=value* + +Add an annotation to the container or pod. The format is key=value. +The **--annotation** option can be set multiple times. + +#### **--authfile**=*path* + +Path of the authentication file. Default is ${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`. +If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`. + +Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE +environment variable. `export REGISTRY_AUTH_FILE=path` + +#### **--build** + +Build images even if they are found in the local storage. Use `--build=false` to completely disable builds. (This option is not available with the remote Podman client) + +#### **--cert-dir**=*path* + +Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry. (Default: /etc/containers/certs.d) +Please refer to containers-certs.d(5) for details. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +#### **--configmap**=*path* + +Use Kubernetes configmap YAML at path to provide a source for environment variable values within the containers of the pod. (This option is not available with the remote Podman client) + +Note: The *--configmap* option can be used multiple times or a comma-separated list of paths can be used to pass multiple Kubernetes configmap YAMLs. + +#### **--context-dir**=*path* + +Use *path* as the build context directory for each image. Requires --build option be true. (This option is not available with the remote Podman client) + +#### **--creds** + +The [username[:password]] to use to authenticate with the registry if required. +If one or both values are not supplied, a command line prompt will appear and the +value can be entered. The password is entered without echo. + +#### **--help**, **-h** + +Print usage statement + +#### **--ip**=*IP address* + +Assign a static ip address to the pod. This option can be specified several times when kube play creates more than one pod. +Note: When joining multiple networks you should use the **--network name:ip=\** syntax. + +#### **--log-driver**=*driver* + +Set logging driver for all created containers. + +#### **--log-opt**=*name=value* + +Set custom logging configuration. The following *name*s are supported: + +- **path**: specify a path to the log file +(e.g. **--log-opt path=/var/log/container/mycontainer.json**); + +- **max-size**: specify a max size of the log file +(e.g. **--log-opt max-size=10mb**); + +- **tag**: specify a custom log tag for the container +(e.g. **--log-opt tag="{{.ImageName}}"**. + +It supports the same keys as **podman inspect --format**. + +This option is currently supported only by the **journald** log driver. + +#### **--mac-address**=*MAC address* + +Assign a static mac address to the pod. This option can be specified several times when kube play creates more than one pod. +Note: When joining multiple networks you should use the **--network name:mac=\** syntax. + +#### **--network**=*mode*, **--net** + +Change the network mode of the pod. The host network mode should be configured in the YAML file. +Valid _mode_ values are: + +- **bridge[:OPTIONS,...]**: Create a network stack on the default bridge. This is the default for rootful containers. It is possible to specify these additional options: + - **alias=name**: Add network-scoped alias for the container. + - **ip=IPv4**: Specify a static ipv4 address for this container. + - **ip=IPv6**: Specify a static ipv6 address for this container. + - **mac=MAC**: Specify a static mac address for this container. + - **interface_name**: Specify a name for the created network interface inside the container. + + For example to set a static ipv4 address and a static mac address, use `--network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99`. +- \[:OPTIONS,...]: Connect to a user-defined network; this is the network name or ID from a network created by **[podman network create](podman-network-create.1.md)**. Using the network name implies the bridge network mode. It is possible to specify the same options described under the bridge mode above. You can use the **--network** option multiple times to specify additional networks. +- **none**: Create a network namespace for the container but do not configure network interfaces for it, thus the container has no network connectivity. +- **container:**_id_: Reuse another container's network stack. +- **ns:**_path_: Path to a network namespace to join. +- **private**: Create a new namespace for the container. This will use the **bridge** mode for rootful containers and **slirp4netns** for rootless ones. +- **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, they can also be set with `network_cmd_options` in containers.conf: + - **allow_host_loopback=true|false**: Allow the slirp4netns to reach the host loopback IP (`10.0.2.2`). Default is false. + - **mtu=MTU**: Specify the MTU to use for this network. (Default is `65520`). + - **cidr=CIDR**: Specify ip range to use for this network. (Default is `10.0.2.0/24`). + - **enable_ipv6=true|false**: Enable IPv6. Default is true. (Required for `outbound_addr6`). + - **outbound_addr=INTERFACE**: Specify the outbound interface slirp should bind to (ipv4 traffic only). + - **outbound_addr=IPv4**: Specify the outbound ipv4 address slirp should bind to. + - **outbound_addr6=INTERFACE**: Specify the outbound interface slirp should bind to (ipv6 traffic only). + - **outbound_addr6=IPv6**: Specify the outbound ipv6 address slirp should bind to. + - **port_handler=rootlesskit**: Use rootlesskit for port forwarding. Default. + Note: Rootlesskit changes the source IP address of incoming packets to an IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks. + - **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks. + +@@option no-hosts + +This option conflicts with host added in the Kubernetes YAML. + +#### **--quiet**, **-q** + +Suppress output information when pulling images + +#### **--replace** + +Tears down the pods created by a previous run of `kube play` and recreates the pods. This option is used to keep the existing pods up to date based upon the Kubernetes YAML. + +#### **--seccomp-profile-root**=*path* + +Directory path for seccomp profiles (default: "/var/lib/kubelet/seccomp"). (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) + +#### **--start** + +Start the pod after creating it, set to false to only create it. + +#### **--tls-verify** + +Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true, +then TLS verification will be used. If set to false, then TLS verification will not be used. If not specified, +TLS verification will be used unless the target registry is listed as an insecure registry in registries.conf. + +#### **--userns**=*mode* + +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 the **--uidmap** and **--gidmap** options. + +Rootless user --userns=Key mappings: + +Key | Host User | Container User +----------|---------------|--------------------- +"" |$UID |0 (Default User account mapped to root user in container.) +keep-id |$UID |$UID (Map user account to same UID within container.) +auto |$UID | nil (Host User UID is not mapped into container.) +nomap |$UID | nil (Host User UID is not mapped into container.) + +Valid _mode_ values are: + +**auto**[:_OPTIONS,..._]: automatically create a unique user namespace. + +The `--userns=auto` flag, requires that the user name `containers` and a range of subordinate user ids that the Podman container is allowed to use be specified in the /etc/subuid and /etc/subgid files. + +Example: `containers:2147483647:2147483648`. + +Podman allocates unique ranges of UIDs and GIDs from the `containers` subordinate user ids. The size of the ranges is based on the number of UIDs required in the image. The number of UIDs and GIDs can be overridden with the `size` option. The `auto` options currently does not work in rootless mode + + Valid `auto` options: + + - *gidmapping*=_CONTAINER_GID:HOST_GID:SIZE_: to force a GID mapping to be present in the user namespace. + - *size*=_SIZE_: to specify an explicit size for the automatic user namespace. e.g. `--userns=auto:size=8192`. If `size` is not specified, `auto` will estimate a size for the user namespace. + - *uidmapping*=_CONTAINER_UID:HOST_UID:SIZE_: to force a UID mapping to be present in the user namespace. + +**container:**_id_: join the user namespace of the specified container. + +**host**: create a new namespace for the container. + +**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 not allowed for containers created by the root user. + +**nomap**: creates a user namespace where the current rootless user's UID:GID are not mapped into the container. This option is not allowed for containers created by the root user. + +**ns:**_namespace_: run the pod in the given existing user namespace. + +## EXAMPLES + +Recreate the pod and containers as described in a file called `demo.yml` +``` +$ podman kube play demo.yml +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 +``` + +Recreate the pod and containers as described in a file `demo.yml` sent to stdin +``` +$ cat demo.yml | podman kube play - +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 + +``` +Teardown the pod and containers as described in a file `demo.yml` +``` +$ podman kube play --down demo.yml +Pods stopped: +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 +Pods removed: +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 +``` + +Provide `configmap-foo.yml` and `configmap-bar.yml` as sources for environment variables within the containers. +``` +$ podman kube play demo.yml --configmap configmap-foo.yml,configmap-bar.yml +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 + +$ podman kube play demo.yml --configmap configmap-foo.yml --configmap configmap-bar.yml +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 +``` + +Create a pod connected to two networks (called net1 and net2) with a static ip +``` +$ podman kube play demo.yml --network net1:ip=10.89.1.5 --network net2:ip=10.89.10.10 +52182811df2b1e73f36476003a66ec872101ea59034ac0d4d3a7b40903b955a6 +``` + +Please take into account that networks must be created first using podman-network-create(1). + +## SEE ALSO +**[podman(1)](podman.1.md)**, **[podman-kube(1)](podman-kube.1.md)**, **[podman-kube-down(1)](podman-kube-down.1.md)**, **[podman-network-create(1)](podman-network-create.1.md)**, **[podman-generate-kube(1)](podman-generate-kube.1.md)**, **[containers-certs.d(5)](https://github.com/containers/image/blob/main/docs/containers-certs.d.5.md)** + +## HISTORY +December 2018, Originally compiled by Brent Baude (bbaude at redhat dot com) diff --git a/docs/source/markdown/podman-pod-clone.1.md.in b/docs/source/markdown/podman-pod-clone.1.md.in index ea8189a7a..a5746fd84 100644 --- a/docs/source/markdown/podman-pod-clone.1.md.in +++ b/docs/source/markdown/podman-pod-clone.1.md.in @@ -15,63 +15,19 @@ podman\-pod\-clone - Creates a copy of an existing pod @@option blkio-weight-device -#### **--cgroup-parent**=*path* +@@option cgroup-parent -Path to cgroups under which the cgroup for the pod 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. - -#### **--cpu-shares**, **-c**=*shares* - -CPU shares (relative weight) - -By default, all containers get the same proportion of CPU cycles. This proportion -can be modified by changing the container's CPU share weighting relative -to the weighting of all other running containers. - -To modify the proportion from the default of 1024, use the **--cpu-shares** -flag to set the weighting to 2 or higher. - -The proportion will only apply when CPU-intensive processes are running. -When tasks in one container are idle, other containers can use the -left-over CPU time. The actual amount of CPU time will vary depending on -the number of containers running on the system. - -For example, consider three containers, one has a cpu-share of 1024 and -two others have a cpu-share setting of 512. When processes in all three -containers attempt to use 100% of CPU, the first container would receive -50% of the total CPU time. If you add a fourth container with a cpu-share -of 1024, the first container only gets 33% of the CPU. The remaining containers -receive 16.5%, 16.5% and 33% of the CPU. - -On a multi-core system, the shares of CPU time are distributed over all CPU -cores. Even if a container is limited to less than 100% of CPU time, it can -use 100% of each individual CPU core. - -For example, consider a system with more than three cores. If you start one -container **{C0}** with **-c=512** running one process, and another container -**{C1}** with **-c=1024** running two processes, this can result in the following -division of CPU shares: - -PID container CPU CPU share -100 {C0} 0 100% of CPU0 -101 {C1} 1 100% of CPU1 -102 {C1} 2 100% of CPU2 +@@option cpu-shares #### **--cpus** Set a number of CPUs for the pod that overrides the original pods CPU limits. If none are specified, the original pod's Nano CPUs are used. -#### **--cpuset-cpus** - -CPUs in which to allow execution (0-3, 0,1). If none are specified, the original pod's CPUset is used. - - -#### **--cpuset-mems**=*nodes* +@@option cpuset-cpus -Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. +If none are specified, the original pod's CPUset is used. -If there are four memory nodes on the system (0-3), use `--cpuset-mems=0,1` -then processes in the container will only use memory from the first -two memory nodes. +@@option cpuset-mems @@option destroy diff --git a/docs/source/markdown/podman-pod-create.1.md.in b/docs/source/markdown/podman-pod-create.1.md.in index d73a4b9e7..73b634548 100644 --- a/docs/source/markdown/podman-pod-create.1.md.in +++ b/docs/source/markdown/podman-pod-create.1.md.in @@ -28,81 +28,25 @@ which by default, is the cgroup parent for all containers joining the pod. Conta ## OPTIONS -#### **--add-host**=*host:ip* +@@option add-host -Add a custom host-to-IP mapping (host:ip) - -Add a line to /etc/hosts. The format is hostname:ip. The **--add-host** -option can be set multiple times. The /etc/hosts file is shared between all containers in the pod. @@option blkio-weight @@option blkio-weight-device -#### **--cgroup-parent**=*path* - -Path to cgroups under which the cgroup for the pod 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. - -#### **--cpu-shares**, **-c**=*shares* - -CPU shares (relative weight) - -By default, all containers get the same proportion of CPU cycles. This proportion -can be modified by changing the container's CPU share weighting relative -to the weighting of all other running containers. - -To modify the proportion from the default of 1024, use the **--cpu-shares** -flag to set the weighting to 2 or higher. - -The proportion will only apply when CPU-intensive processes are running. -When tasks in one container are idle, other containers can use the -left-over CPU time. The actual amount of CPU time will vary depending on -the number of containers running on the system. - -For example, consider three containers, one has a cpu-share of 1024 and -two others have a cpu-share setting of 512. When processes in all three -containers attempt to use 100% of CPU, the first container would receive -50% of the total CPU time. If you add a fourth container with a cpu-share -of 1024, the first container only gets 33% of the CPU. The remaining containers -receive 16.5%, 16.5% and 33% of the CPU. +@@option cgroup-parent -On a multi-core system, the shares of CPU time are distributed over all CPU -cores. Even if a container is limited to less than 100% of CPU time, it can -use 100% of each individual CPU core. - -For example, consider a system with more than three cores. If you start one -container **{C0}** with **-c=512** running one process, and another container -**{C1}** with **-c=1024** running two processes, this can result in the following -division of CPU shares: - -PID container CPU CPU share -100 {C0} 0 100% of CPU0 -101 {C1} 1 100% of CPU1 -102 {C1} 2 100% of CPU2 +@@option cpu-shares #### **--cpus**=*amount* Set the total number of CPUs delegated to the pod. Default is 0.000 which indicates that there is no limit on computation power. -#### **--cpuset-cpus**=*amount* - -Limit the CPUs to support execution. First CPU is numbered 0. Unlike --cpus this is of type string and parsed as a list of numbers - -Format is 0-3,0,1 - -Examples of the List Format: - -0-4,9 # bits 0, 1, 2, 3, 4, and 9 set -0-2,7,12-14 # bits 0, 1, 2, 7, 12, 13, and 14 set - -#### **--cpuset-mems**=*nodes* - -Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. +@@option cpuset-cpus -If there are four memory nodes on the system (0-3), use `--cpuset-mems=0,1` -then processes in the container will only use memory from the first -two memory nodes. +@@option cpuset-mems #### **--device**=_host-device_[**:**_container-device_][**:**_permissions_] @@ -260,11 +204,8 @@ Valid _mode_ values are: @@option network-alias -#### **--no-hosts** +@@option no-hosts -Do not create _/etc/hosts_ for the pod. -By default, Podman will manage _/etc/hosts_, adding the container's own IP address and any hosts from **--add-host**. -**--no-hosts** disables this, and the image's _/etc/hosts_ will be preserved unmodified. This option conflicts with **--add-host**. @@option pid.pod diff --git a/docs/source/markdown/podman-run.1.md.in b/docs/source/markdown/podman-run.1.md.in index ce552baf6..21ce566ce 100644 --- a/docs/source/markdown/podman-run.1.md.in +++ b/docs/source/markdown/podman-run.1.md.in @@ -83,12 +83,7 @@ and specified with a _tag_. $ podman run oci-archive:/tmp/fedora echo hello ## OPTIONS -#### **--add-host**=*host:ip* - -Add a custom host-to-IP mapping (host:ip) - -Add a line to /etc/hosts. The format is hostname:ip. The **--add-host** -option can be set multiple times. +@@option add-host #### **--annotation**=*key=value* @@ -126,31 +121,11 @@ environment variable. @@option cgroup-conf -#### **--cgroup-parent**=*path* - -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. - -#### **--cgroupns**=*mode* - -Set the cgroup namespace mode for the container. +@@option cgroup-parent -- **host**: use the host's cgroup namespace inside the container. -- **container:**_id_: join the namespace of the specified container. -- **private**: create a new cgroup namespace. -- **ns:**_path_: join the namespace at the specified path. +@@option cgroupns -If the host uses cgroups v1, the default is set to **host**. On cgroups v2, the default is **private**. - -#### **--cgroups**=*how* - -Determines whether the container will create CGroups. - -Default is **enabled**. - -The **enabled** option will create a new cgroup under the cgroup-parent. -The **disabled** option will force the container to not create CGroups, and thus conflicts with CGroup options (**--cgroupns** and **--cgroup-parent**). -The **no-conmon** option disables a new CGroup only for the **conmon** process. -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**. +@@option cgroups @@option chrootdirs @@ -158,88 +133,17 @@ The **split** option splits the current CGroup in two sub-cgroups: one for conmo Write the container ID to *file*. -#### **--conmon-pidfile**=*file* - -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. -(This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) - -#### **--cpu-period**=*limit* - -Set the CPU period for the Completely Fair Scheduler (CFS), which is a -duration in microseconds. Once the container's CPU quota is used up, it will -not be scheduled to run until the current period ends. Defaults to 100000 -microseconds. - -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error - -#### **--cpu-quota**=*limit* - -Limit the CPU Completely Fair Scheduler (CFS) quota. - -Limit the container's CPU usage. By default, containers run with the full -CPU resource. The limit is a number in microseconds. If you provide a number, -the container will be allowed to use that much CPU time until the CPU period -ends (controllable via **--cpu-period**). +@@option conmon-pidfile -On some systems, changing the CPU limits may not be allowed for non-root -users. For more details, see -https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error - -#### **--cpu-rt-period**=*microseconds* - -Limit the CPU real-time period in microseconds. - -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. - -This flag is not supported on cgroups V2 systems. - -#### **--cpu-rt-runtime**=*microseconds* - -Limit the CPU real-time runtime in microseconds. - -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: -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. +@@option cpu-period -The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. +@@option cpu-quota -This flag is not supported on cgroups V2 systems. +@@option cpu-rt-period -#### **--cpu-shares**, **-c**=*shares* +@@option cpu-rt-runtime -CPU shares (relative weight). - -By default, all containers get the same proportion of CPU cycles. This proportion -can be modified by changing the container's CPU share weighting relative -to the combined weight of all the running containers. Default weight is **1024**. - -The proportion will only apply when CPU-intensive processes are running. -When tasks in one container are idle, other containers can use the -left-over CPU time. The actual amount of CPU time will vary depending on -the number of containers running on the system. - -For example, consider three containers, one has a cpu-share of 1024 and -two others have a cpu-share setting of 512. When processes in all three -containers attempt to use 100% of CPU, the first container would receive -50% of the total CPU time. If you add a fourth container with a cpu-share -of 1024, the first container only gets 33% of the CPU. The remaining containers -receive 16.5%, 16.5% and 33% of the CPU. - -On a multi-core system, the shares of CPU time are distributed over all CPU -cores. Even if a container is limited to less than 100% of CPU time, it can -use 100% of each individual CPU core. - -For example, consider a system with more than three cores. -If the container _C0_ is started with **--cpu-shares=512** running one process, -and another container _C1_ with **--cpu-shares=1024** running two processes, -this can result in the following division of CPU shares: - -| PID | container | CPU | CPU share | -| ---- | ----------- | ------- | ------------ | -| 100 | C0 | 0 | 100% of CPU0 | -| 101 | C1 | 1 | 100% of CPU1 | -| 102 | C1 | 2 | 100% of CPU2 | +@@option cpu-shares #### **--cpus**=*number* @@ -251,18 +155,9 @@ On some systems, changing the CPU limits may not be allowed for non-root users. For more details, see https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error -#### **--cpuset-cpus**=*number* - -CPUs in which to allow execution. Can be specified as a comma-separated list -(e.g. **0,1**), as a range (e.g. **0-3**), or any combination thereof -(e.g. **0-3,7,11-15**). - -#### **--cpuset-mems**=*nodes* - -Memory nodes (MEMs) in which to allow execution. Only effective on NUMA systems. +@@option cpuset-cpus -For example, if you have four memory nodes (0-3) on your system, use **--cpuset-mems=0,1** -to only use memory from the first two memory nodes. +@@option cpuset-mems #### **--detach**, **-d** @@ -569,11 +464,8 @@ Valid _mode_ values are: @@option no-healthcheck -#### **--no-hosts** +@@option no-hosts -Do not create _/etc/hosts_ for the container. -By default, Podman will manage _/etc/hosts_, adding the container's own IP address and any hosts from **--add-host**. -**--no-hosts** disables this, and the image's _/etc/hosts_ will be preserved unmodified. This option conflicts with **--add-host**. @@option oom-kill-disable diff --git a/hack/markdown-preprocess b/hack/markdown-preprocess index 0b66abb06..86667a32d 100755 --- a/hack/markdown-preprocess +++ b/hack/markdown-preprocess @@ -29,7 +29,7 @@ def process(infile): # Some options are the same between containers and pods; determine # which description to use from the name of the source man page. pod_or_container = 'container' - if '-pod-' in infile: + if '-pod-' in infile or '-kube-' in infile: pod_or_container = 'pod' # Sometimes a man page includes the subcommand. diff --git a/hack/markdown-preprocess-review b/hack/markdown-preprocess-review index e8b042e94..a487265ad 100755 --- a/hack/markdown-preprocess-review +++ b/hack/markdown-preprocess-review @@ -26,7 +26,7 @@ while (my $line = <$git_diff>) { if ($line =~ s/^-####\s+//) { $line =~ /^\*\*--(\S+?)\*\*/ or die "$ME: in $newname: weird '$line'"; - $changed{$newname}{$1}{name} = $1; + $changed{$newname}{$1}{name} //= $1; } # Usually the same, but not for host.container and host.pod.md elsif ($line =~ /^\+\@\@option\s+(\S+)/) { @@ -86,7 +86,7 @@ for my $md_file (sort keys %changed) { or die "$ME: Error writing $outfile: $!\n"; my $new_text = "$DSM/options/$changed{$md_file}{$opt}{name}.md"; - die "$ME: File does not exist: $new_text\n" if ! -e $new_text; + die "$ME: $md_file: File does not exist: $new_text\n" if ! -e $new_text; system('cp', $new_text, "$d/zzz-chosen.md"); } } -- cgit v1.2.3-54-g00ecf