mirror of https://github.com/docker/docs.git
engine: clarify localhost ports access on local networks
Ports published on the localhost IP are still accessible by other systems connected to the same local network. Signed-off-by: David Karlsson <david.karlsson@docker.com>
This commit is contained in:
parent
75962c0acd
commit
18f88f0feb
|
|
@ -51,12 +51,20 @@ Here are some examples:
|
||||||
> a container's ports it becomes available not only to the Docker host, but to
|
> a container's ports it becomes available not only to the Docker host, but to
|
||||||
> the outside world as well.
|
> the outside world as well.
|
||||||
>
|
>
|
||||||
> To publish a container's port and only expose it to the Docker host, include
|
> If you include the localhost IP address (`127.0.0.1`) with the publish flag,
|
||||||
> the localhost IP address (`127.0.0.1`) in the port mapping command.
|
> only the Docker host can the published container port.
|
||||||
>
|
>
|
||||||
> ```console
|
> ```console
|
||||||
> $ docker run -p 127.0.0.1:8080:80 nginx
|
> $ docker run -p 127.0.0.1:8080:80 nginx
|
||||||
> ```
|
> ```
|
||||||
|
>
|
||||||
|
> > **Warning**
|
||||||
|
> >
|
||||||
|
> > Hosts within the same L2 segment (for example, hosts connected to the same
|
||||||
|
> > network switch) can reach ports published to localhost.
|
||||||
|
> > For more information, see
|
||||||
|
> > [moby/moby#45610](https://github.com/moby/moby/issues/45610)
|
||||||
|
> {: .warning }
|
||||||
{: .important }
|
{: .important }
|
||||||
|
|
||||||
If you want to make a container accessible to other containers,
|
If you want to make a container accessible to other containers,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue