Skip to main content

Docker - Container Networking

Port Publishing & Mapping

Each docker container is assigned its own internal IP on the host. The container can then publish a port which it's service/process can be accessed on. In this example, lets say I have a webapp running in a docker container on port 5000 on the internal IP 172.168.1.110. I want this web app to be accessible via port 80 on the host;

Map a container port to host port
docker run -p80:5000 containername