summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-06-28 11:06:46 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-07-06 13:37:27 -0400
commit1c02d5ab890ba7de6d0ad0603438107e086c18b7 (patch)
treef921318dbb8e9eb6ba4179d11a5171a7e237c0c6 /docs
parent56c873c14e68c0cb63488ad7ded60e831c2d4194 (diff)
downloadpodman-1c02d5ab890ba7de6d0ad0603438107e086c18b7.tar.gz
podman-1c02d5ab890ba7de6d0ad0603438107e086c18b7.tar.bz2
podman-1c02d5ab890ba7de6d0ad0603438107e086c18b7.zip
Allow empty host port in --publish flag
I didn't believe that this was actually legal, but it looks like it is. And, unlike our previous understanding (host port being empty means just use container port), empty host port actually carries the same meaning as `--expose` + `--publish-all` (that is, assign a random host port to the given container port). This requires a significant rework of our port handling code to handle this new case. I don't foresee this being commonly used, so I optimized having a fixed port number as fast path, which this random assignment code running after the main port handling code only if necessary. Fixes #6806 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'docs')
-rw-r--r--docs/source/markdown/podman-create.1.md2
-rw-r--r--docs/source/markdown/podman-run.1.md3
2 files changed, 5 insertions, 0 deletions
diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md
index 3ec91a3ad..7c2903e33 100644
--- a/docs/source/markdown/podman-create.1.md
+++ b/docs/source/markdown/podman-create.1.md
@@ -623,6 +623,8 @@ When specifying ranges for both, the number of container ports in the range must
(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 ip: `podman run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage`
+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`
**--publish-all**, **-P**=*true|false*
diff --git a/docs/source/markdown/podman-run.1.md b/docs/source/markdown/podman-run.1.md
index 7e91a06a3..6b6ab03f6 100644
--- a/docs/source/markdown/podman-run.1.md
+++ b/docs/source/markdown/podman-run.1.md
@@ -632,6 +632,9 @@ 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.
+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**.
**--publish-all**, **-P**=**true**|**false**