About
Port Management in docker.
Articles Related
Management
List
docker port list port mappings or a specific mapping for the container
All
docker port containerName
one
Look up what port is mapped externally to port 5000 inside the container.
docker port nostalgic_morse 5000
0.0.0.0:49155
Redirection
Redirecting the port 80 from the host to the port 80 of the container
Format
-p host_port:container_port
#or
-p IP::port
- with docker run
docker run -d -p 80:80 user/image
Expose
In a dockerfile, you can open a port (expose it) with the expose command
EXPOSE 80
Find
- Find out what host port the container’s containerName port 22 is mapped to
docker port containerName 22
0.0.0.0:49154