diff --git a/docs/sources/use/index.rst b/docs/sources/use/index.rst index a1086c1fd2..2f74f60718 100644 --- a/docs/sources/use/index.rst +++ b/docs/sources/use/index.rst @@ -14,6 +14,7 @@ Contents: basics workingwithrepository + port_redirection builder puppet diff --git a/docs/sources/use/port_redirection.rst b/docs/sources/use/port_redirection.rst new file mode 100644 index 0000000000..c0b4041e7c --- /dev/null +++ b/docs/sources/use/port_redirection.rst @@ -0,0 +1,23 @@ +:title: Port redirection +:description: usage about port redirection +:keywords: Usage, basic port, docker, documentation, examples + + +Port redirection +================ + +Port redirection is done on ``docker run`` using the -p flag. + +Here are the 3 ways to redirect a port: + +.. code-block:: bash + + # the port 80 in the container is mapped to a random port of the host + docker run -p 80 + + # the port 80 in the container is mapped to the port 80 of the host + docker run -p :80 + + # the port 80 in the container is mapped to the port 5555 of the host + docker run -p 5555:80 +