summaryrefslogtreecommitdiff
path: root/docs/source/markdown/podman-create.1.md
diff options
context:
space:
mode:
authorDaniel Rudolf <github.com@daniel-rudolf.de>2022-06-02 14:26:51 +0200
committerDaniel Rudolf <github.com@daniel-rudolf.de>2022-06-02 14:26:51 +0200
commit5b9729c479fc8a4452edea126f81c90d9f1808b4 (patch)
tree260e55c1018a099c76a72c95fe4b69eca3817347 /docs/source/markdown/podman-create.1.md
parent2c63b8a2fdbc1e72711e09417380fd67063b07d3 (diff)
downloadpodman-5b9729c479fc8a4452edea126f81c90d9f1808b4.tar.gz
podman-5b9729c479fc8a4452edea126f81c90d9f1808b4.tar.bz2
podman-5b9729c479fc8a4452edea126f81c90d9f1808b4.zip
Document protocol usage for --publish
This also unifies the documentation of `--publish` for `podman create`, `podman run`, and `podman pod create`. Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'docs/source/markdown/podman-create.1.md')
-rw-r--r--docs/source/markdown/podman-create.1.md23
1 files changed, 14 insertions, 9 deletions
diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md
index 009209343..8a1bfcee1 100644
--- a/docs/source/markdown/podman-create.1.md
+++ b/docs/source/markdown/podman-create.1.md
@@ -826,22 +826,27 @@ container.
Rootless containers cannot have more privileges than the account that launched them.
-#### **--publish**, **-p**=*port*
+#### **--publish**, **-p**=[[_ip_:][_hostPort_]:]_containerPort_[/_protocol_]
-Publish a container's port, or range of ports, to the host
+Publish a container's port, or range of ports, to the host.
-Format: `ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort`
Both hostPort and containerPort can be specified as a range of ports.
-When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range.
-(e.g., `podman run -p 1234-1236:1222-1224 --name thisWorks -t busybox`
-but not `podman run -p 1230-1236:1230-1240 --name RangeContainerPortsBiggerThanRangeHostPorts -t busybox`)
-With host IP: `podman run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage`
+When specifying ranges for both, the number of container ports in the
+range must match the number of host ports in the range.
+
If host IP is set to 0.0.0.0 or not set at all, the port will be bound on all IPs on the host.
+
+By default, Podman will publish TCP ports. To publish a UDP port instead, give
+`udp` as protocol. To publish both TCP and UDP ports, set `--publish` twice,
+with `tcp`, and `udp` as protocols respectively. Rootful containers can also
+publish ports using the `sctp` protocol.
+
Host port does not have to be specified (e.g. `podman run -p 127.0.0.1::80`).
If it is not, the container port will be randomly assigned a port on the host.
-Use `podman port` to see the actual mapping: `podman port CONTAINER $CONTAINERPORT`
-**Note:** if a container will be run within a pod, it is not necessary to publish the port for
+Use **podman port** to see the actual mapping: `podman port $CONTAINER $CONTAINERPORT`.
+
+**Note:** If a container will be run within a pod, it is not necessary to publish the port for
the containers in the pod. The port must only be published by the pod itself. Pod network
stacks act like the network stack on the host - you have a variety of containers in the pod,
and programs in the container, all sharing a single interface and IP address, and