mirror of
https://github.com/wsargent/docker-cheat-sheet.git
synced 2025-12-18 16:10:12 +01:00
Update README.md
This commit is contained in:
parent
b6868f16a9
commit
8eff9c652d
1 changed files with 2 additions and 2 deletions
|
|
@ -276,13 +276,13 @@ You can also use remote NFS volume if you're [feeling brave](http://www.tech-d.n
|
||||||
Exposing incoming ports through the host container is [fiddly but doable](https://docs.docker.com/reference/run/#expose-incoming-ports).
|
Exposing incoming ports through the host container is [fiddly but doable](https://docs.docker.com/reference/run/#expose-incoming-ports).
|
||||||
|
|
||||||
|
|
||||||
Then map the container port to the host port (only using localhost interface):
|
The fastest way is to map the container port to the host port (only using localhost interface) using `-p`:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage
|
docker run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't want to use the `-p` option on the command line, you can persist it by using [EXPOSE](http://docs.docker.io/reference/builder/#expose):
|
If you don't want to use the `-p` option on the command line, you can persist port forwarding by using [EXPOSE](http://docs.docker.io/reference/builder/#expose):
|
||||||
|
|
||||||
```
|
```
|
||||||
EXPOSE <CONTAINERPORT>
|
EXPOSE <CONTAINERPORT>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue