Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor common man page options, phase 2 #15250

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/markdown/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
podman-container-clone.1.md
podman-create.1.md
podman-pod-clone.1.md
podman-pod-create.1.md
podman-pull.1.md
podman-run.1.md
44 changes: 44 additions & 0 deletions docs/source/markdown/options/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Common Man Page Options
=======================

This subdirectory contains option (flag) names and descriptions
common to multiple podman man pages. Each file is one option. The
filename does not necessarily need to be identical to the option
name: for instance, `hostname.container.md` and `hostname.pod.md`
exist because the **--hostname** option is sufficiently different
between `podman-{create,run}` and `podman-pod-{create,run}` to
warrant living separately.

How
===

The files here are included in `podman-*.md.in` files using the `@@option`
mechanism:

```
@@option foo ! will include options/foo.md
```

The tool that does this is `hack/markdown-preprocess`. It is a python
script because it needs to run on `readthedocs.io`. From a given `.md.in`
file, this script will create a `.md` file that can then be read by
`go-md2man`, `sphinx`, anything that groks markdown. This runs as
part of `make docs`.

Special Substitutions
=====================

Some options are almost identical except for 'pod' vs 'container'
differences. For those, use `<<text for pods|text for containers>>`.
Order is immaterial: the important thing is the presence of the
string "`pod`" in one half but not the other. The correct string
will be chosen based on the filename: if the file contains `-pod`,
such as `podman-pod-create`, the string with `pod` (case-insensitive)
in it will be chosen.

The string `<<subcommand>>` will be replaced with the podman subcommand
as determined from the filename, e.g., `create` for `podman-create.1.md.in`.
This allows the shared use of examples in the option file:
```
Example: podman <<subcommand>> --foo --bar
```
3 changes: 3 additions & 0 deletions docs/source/markdown/options/blkio-weight-device.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--blkio-weight-device**=*device:weight*

Block IO relative device weight.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/blkio-weight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--blkio-weight**=*weight*

Block IO relative weight. The _weight_ is a value between **10** and **1000**.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/cap-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--cap-add**=*capability*

Add Linux capabilities.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/cap-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--cap-drop**=*capability*

Drop Linux capabilities.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--destroy**

Remove the original <<container|pod>> that we are cloning once used to mimic the configuration.
17 changes: 17 additions & 0 deletions docs/source/markdown/options/entrypoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#### **--entrypoint**=*"command"* | *'["command", "arg1", ...]'*

Overwrite the default ENTRYPOINT of the image.

This option allows you to overwrite the default entrypoint of the image.

The ENTRYPOINT of an image is similar to a COMMAND
because it specifies what executable to run when the container starts, but it is
(purposely) more difficult to override. The ENTRYPOINT gives a container its
default nature or behavior, so that when you set an ENTRYPOINT you can run the
container as if it were that binary, complete with default options, and you can
pass in more options via the COMMAND. But, sometimes an operator may want to run
something else inside the container, so you can override the default ENTRYPOINT
at runtime by using a **--entrypoint** and a string to specify the new
ENTRYPOINT.

You need to specify multi option commands in the form of a json string.
4 changes: 4 additions & 0 deletions docs/source/markdown/options/expose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### **--expose**=*port*

Expose a port, or a range of ports (e.g. **--expose=3300-3310**) to set up port redirection
on the host system.
8 changes: 8 additions & 0 deletions docs/source/markdown/options/health-cmd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#### **--health-cmd**=*"command"* | *'["command", "arg1", ...]'*

Set or alter a healthcheck command for a container. The command is a command to be executed inside your
container that determines your container health. The command is required for other healthcheck options
to be applied. A value of **none** disables existing healthchecks.

Multiple options can be passed in the form of a JSON array; otherwise, the command will be interpreted
as an argument to **/bin/sh -c**.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/health-interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--health-interval**=*interval*

Set an interval for the healthchecks. An _interval_ of **disable** results in no automatic timer setup. The default is **30s**.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/health-retries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--health-retries**=*retries*

The number of retries allowed before a healthcheck is considered to be unhealthy. The default value is **3**.
4 changes: 4 additions & 0 deletions docs/source/markdown/options/health-start-period.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### **--health-start-period**=*period*

The initialization time needed for a container to bootstrap. The value can be expressed in time format like
**2m3s**. The default value is **0s**.
4 changes: 4 additions & 0 deletions docs/source/markdown/options/health-timeout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### **--health-timeout**=*timeout*

The maximum time allowed to complete the healthcheck before an interval is considered failed. Like start-period, the
value can be expressed in a time format such as **1m22s**. The default value is **30s**.
5 changes: 5 additions & 0 deletions docs/source/markdown/options/hostname.container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### **--hostname**, **-h**=*name*

Container host name

Sets the container host name that is available inside the container. Can only be used with a private UTS namespace `--uts=private` (default). If `--pod` is specified and the pod shares the UTS namespace (default) the pod's hostname will be used.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/hostname.pod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--hostname**=*name*

Set a hostname to the pod.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/infra-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--infra-command**=*command*

The command that will be run to start the infra container. Default: "/pause".
3 changes: 3 additions & 0 deletions docs/source/markdown/options/infra-conmon-pidfile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--infra-conmon-pidfile**=*file*

Write the pid of the infra container's **conmon** process to a file. As **conmon** runs in a separate process than Podman, this is necessary when using systemd to manage Podman containers and pods.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/infra-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--infra-name**=*name*

The name that will be used for the pod's infra container.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/label-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--label-file**=*file*

Read in a line-delimited file of labels.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/link-local-ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--link-local-ip**=*ip*

Not implemented.
12 changes: 12 additions & 0 deletions docs/source/markdown/options/log-driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### **--log-driver**=*driver*

Logging driver for the container. Currently available options are **k8s-file**, **journald**, **none** and **passthrough**, with **json-file** aliased to **k8s-file** for scripting compatibility. (Default **journald**).

The podman info command below will display the default log-driver for the system.
```
$ podman info --format '{{ .Host.LogDriver }}'
journald
```
The **passthrough** driver passes down the standard streams (stdin, stdout, stderr) to the
container. It is not allowed with the remote Podman client, including Mac and Windows (excluding WSL2) machines, and on a tty, since it is
vulnerable to attacks via TIOCSTI.
11 changes: 11 additions & 0 deletions docs/source/markdown/options/mac-address.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#### **--mac-address**=*address*

<<Container|Pod>> network interface MAC address (e.g. 92:d0:c6:0a:29:33)
This option can only be used if the <<container|pod>> is joined to only a single network - i.e., **--network=_network-name_** is used at most once -
and if the <<container|pod>> is not joining another container's network namespace via **--network=container:_id_**.

Remember that the MAC address in an Ethernet network must be unique.
The IPv6 link-local address will be based on the device's MAC address
according to RFC4862.

To specify multiple static MAC addresses per <<container|pod>>, set multiple networks using the **--network** option with a static MAC address specified for each using the `mac` mode for that option.
5 changes: 5 additions & 0 deletions docs/source/markdown/options/memory-swappiness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### **--memory-swappiness**=*number*

Tune a container's memory swappiness behavior. Accepts an integer between *0* and *100*.

This flag is not supported on cgroups V2 systems.
8 changes: 8 additions & 0 deletions docs/source/markdown/options/network-alias.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#### **--network-alias**=*alias*

Add a network-scoped alias for the <<container|pod>>, setting the alias for all networks that the container joins. To set a
name only for a specific network, use the alias option as described under the **--network** option.
If the network has DNS enabled (`podman network inspect -f {{.DNSEnabled}} <name>`),
these aliases can be used for name resolution on the given network. This option can be specified multiple times.
NOTE: When using CNI a <<container|pod>> will only have access to aliases on the first network that it joins. This limitation does
not exist with netavark/aardvark-dns.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/oom-score-adj.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--oom-score-adj**=*num*

Tune the host's OOM preferences for containers (accepts values from **-1000** to **1000**).
7 changes: 7 additions & 0 deletions docs/source/markdown/options/pid.pod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### **--pid**=*pid*

Set the PID mode for the pod. The default is to create a private PID namespace for the pod. Requires the PID namespace to be shared via --share.

host: use the host’s PID namespace for the pod
ns: join the specified PID namespace
private: create a new namespace for the pod (default)
3 changes: 3 additions & 0 deletions docs/source/markdown/options/pids-limit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--pids-limit**=*limit*

Tune the container's pids limit. Set to **-1** to have unlimited pids for the container. The default is **4096** on systems that support "pids" cgroup controller.
4 changes: 4 additions & 0 deletions docs/source/markdown/options/platform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### **--platform**=*OS/ARCH*

Specify the platform for selecting the image. (Conflicts with --arch and --os)
The `--platform` option can be used to override the current architecture and operating system.
8 changes: 8 additions & 0 deletions docs/source/markdown/options/pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#### **--pull**=*policy*

Pull image policy. The default is **missing**.

- **always**: 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**: 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.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/read-only-tmpfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--read-only-tmpfs**

If container is running in **--read-only** mode, then mount a read-write tmpfs on _/run_, _/tmp_, and _/var/tmp_. The default is **true**.
7 changes: 7 additions & 0 deletions docs/source/markdown/options/read-only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### **--read-only**

Mount the container's root filesystem as read-only.

By default a container will have its root filesystem writable allowing processes
to write files anywhere. By specifying the **--read-only** flag, the container will have
its root filesystem mounted as read-only prohibiting any writes.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/replace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--replace**

If another <<container|pod>> with the same name already exists, replace and remove it. The default is **false**.
5 changes: 5 additions & 0 deletions docs/source/markdown/options/requires.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### **--requires**=*container*

Specify one or more requirements.
A requirement is a dependency container that will be started before this container.
Containers can be specified by name or ID, with multiple containers being separated by commas.
22 changes: 22 additions & 0 deletions docs/source/markdown/options/secret.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#### **--secret**=*secret[,opt=opt ...]*

Give the container access to a secret. Can be specified multiple times.

A secret is a blob of sensitive data which a container needs at runtime but
should not be stored in the image or in source control, such as usernames and passwords,
TLS certificates and keys, SSH keys or other important generic strings or binary content (up to 500 kb in size).

When secrets are specified as type `mount`, the secrets are copied and mounted into the container when a container is created.
When secrets are specified as type `env`, the secret will be set as an environment variable within the container.
Secrets are written in the container at the time of container creation, and modifying the secret using `podman secret` commands
after the container is created will not affect the secret inside the container.

Secrets and its storage are managed using the `podman secret` command.

Secret Options

- `type=mount|env` : How the secret will be exposed to the container. Default mount.
- `target=target` : Target of secret. Defaults to secret name.
- `uid=0` : UID of secret. Defaults to 0. Mount secret type only.
- `gid=0` : GID of secret. Defaults to 0. Mount secret type only.
- `mode=0` : Mode of secret. Defaults to 0444. Mount secret type only.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/stop-signal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--stop-signal**=*signal*

Signal to stop a container. Default is **SIGTERM**.
4 changes: 4 additions & 0 deletions docs/source/markdown/options/stop-timeout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### **--stop-timeout**=*seconds*

Timeout to stop a container. Default is **10**.
Remote connections use local containers.conf for defaults
14 changes: 14 additions & 0 deletions docs/source/markdown/options/tmpfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#### **--tmpfs**=*fs*

Create a tmpfs mount.

Mount a temporary filesystem (**tmpfs**) mount into a container, for example:

```
$ podman <<subcommand>> -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image
```

This command mounts a **tmpfs** at _/tmp_ within the container. The supported mount
options are the same as the Linux default mount flags. If you do not specify
any options, the system uses the following options:
**rw,noexec,nosuid,nodev**.
79 changes: 79 additions & 0 deletions docs/source/markdown/options/uidmap.container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#### **--uidmap**=*container_uid:from_uid:amount*

Run the container in a new user namespace using the supplied UID mapping. This
option conflicts with the **--userns** and **--subuidname** options. This
option provides a way to map host UIDs to container UIDs. It can be passed
several times to map different ranges.

The _from_uid_ value is based upon the user running the command, either rootful or rootless users.
* rootful user: *container_uid*:*host_uid*:*amount*
* rootless user: *container_uid*:*intermediate_uid*:*amount*

When **podman <<subcommand>>** is called by a privileged user, the option **--uidmap**
works as a direct mapping between host UIDs and container UIDs.

host UID -> container UID

The _amount_ specifies the number of consecutive UIDs that will be mapped.
If for example _amount_ is **4** the mapping would look like:

| host UID | container UID |
| - | - |
| _from_uid_ | _container_uid_ |
| _from_uid_ + 1 | _container_uid_ + 1 |
| _from_uid_ + 2 | _container_uid_ + 2 |
| _from_uid_ + 3 | _container_uid_ + 3 |

When **podman <<subcommand>>** is called by an unprivileged user (i.e. running rootless),
the value _from_uid_ is interpreted as an "intermediate UID". In the rootless
case, host UIDs are not mapped directly to container UIDs. Instead the mapping
happens over two mapping steps:

host UID -> intermediate UID -> container UID

The **--uidmap** option only influences the second mapping step.

The first mapping step is derived by Podman from the contents of the file
_/etc/subuid_ and the UID of the user calling Podman.

First mapping step:

| host UID | intermediate UID |
| - | - |
| UID for the user starting Podman | 0 |
| 1st subordinate UID for the user starting Podman | 1 |
| 2nd subordinate UID for the user starting Podman | 2 |
| 3rd subordinate UID for the user starting Podman | 3 |
| nth subordinate UID for the user starting Podman | n |

To be able to use intermediate UIDs greater than zero, the user needs to have
subordinate UIDs configured in _/etc/subuid_. See **subuid**(5).

The second mapping step is configured with **--uidmap**.

If for example _amount_ is **5** the second mapping step would look like:

| intermediate UID | container UID |
| - | - |
| _from_uid_ | _container_uid_ |
| _from_uid_ + 1 | _container_uid_ + 1 |
| _from_uid_ + 2 | _container_uid_ + 2 |
| _from_uid_ + 3 | _container_uid_ + 3 |
| _from_uid_ + 4 | _container_uid_ + 4 |

When running as rootless, Podman will use all the ranges configured in the _/etc/subuid_ file.

The current user ID is mapped to UID=0 in the rootless user namespace.
Every additional range is added sequentially afterward:

| host |rootless user namespace | length |
| - | - | - |
| $UID | 0 | 1 |
| 1 | $FIRST_RANGE_ID | $FIRST_RANGE_LENGTH |
| 1+$FIRST_RANGE_LENGTH | $SECOND_RANGE_ID | $SECOND_RANGE_LENGTH|

Even if a user does not have any subordinate UIDs in _/etc/subuid_,
**--uidmap** could still be used to map the normal UID of the user to a
container UID by running `podman <<subcommand>> --uidmap $container_uid:0:1 --user $container_uid ...`.

Note: the **--uidmap** flag cannot be called in conjunction with the **--pod** flag as a uidmap cannot be set on the container level when in a pod.
6 changes: 6 additions & 0 deletions docs/source/markdown/options/uidmap.pod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#### **--uidmap**=*container_uid:from_uid:amount*

Run all containers in the pod in a new user namespace using the supplied mapping. This
option conflicts with the **--userns** and **--subuidname** options. This
option provides a way to map host UIDs to container UIDs. It can be passed
several times to map different ranges.
3 changes: 3 additions & 0 deletions docs/source/markdown/options/ulimit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### **--ulimit**=*option*

Ulimit options. You can use **host** to copy the current configuration from the host.
5 changes: 5 additions & 0 deletions docs/source/markdown/options/unsetenv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### **--unsetenv**=*env*

Unset default environment variables for the container. Default environment
variables include variables provided natively by Podman, environment variables
configured by the image, and environment variables from containers.conf.
8 changes: 8 additions & 0 deletions docs/source/markdown/options/uts.container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#### **--uts**=*mode*

Set the UTS namespace mode for the container. The following values are supported:

- **host**: use the host's UTS namespace inside the container.
- **private**: create a new namespace for the container (default).
- **ns:[path]**: run the container in the given existing UTS namespace.
- **container:[container]**: join the UTS namespace of the specified container.
Loading