Port mapping
Port mapping forwards network traffic from a port in one network environment to a port in another, such as from a host to a container.
.NET in Action, Second Edition
Port mapping associates a host network port with a port exposed by a container.
- How it is used
- Makes a web service running inside a Docker container reachable through a host machine port.
- How deep it goes
- Distinguishes EXPOSE from publication and demonstrates host-to-container routing with concrete localhost URLs.
- Examples
- Uses AsciiArtSvc, EXPOSE 5101, host port 5000, localhost URLs, and Docker Desktop's port-assignment dialog.
- What you can do after
- Operate/configure a containerized web service by assigning a host port to its exposed container port.
Read how .NET in Action, Second Edition explains port mapping →
Build Python Web Apps with Streamlit
Container port mapping connects a port on the host machine to a port exposed by a Docker container.
- How it is used
- Connects browser traffic on the host to a Streamlit server running inside a Docker container.
- How deep it goes
- Explains host and container roles, command syntax, local access, and Elastic Beanstalk configuration without covering networking internals.
- Examples
- Uses 8502:8501 locally and 80:8501 for Elastic Beanstalk deployment.
- What you can do after
- Operate a containerized Streamlit app locally and configure its exposed port for Elastic Beanstalk.
Read how Build Python Web Apps with Streamlit explains port mapping →
Also covered in
- Kubernetes in Action, Second Edition
- Fight Fraud with Machine LearningIn early access (MEAP)
Related concepts
- docker-compose.ymlconfigured by · A YAML configuration file that declares services and related settings, such as networks and volumes, for a multi-container application.
- containerconfigures · A software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
- port numberconfigures · A port number is a transport-layer identifier associated with a host address that directs network traffic to a service or application endpoint.
Questions about port mapping
What is port mapping?
Port mapping forwards network traffic from a port in one network environment to a port in another, such as from a host to a container.
Which Manning books explain port mapping?
.NET in Action, Second Edition and Build Python Web Apps with Streamlit.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

