Port Mapping is a term used to link a specific port within the container where the application is presumed to be running to a port of the host system where the container is running. Since docker runs containers in an isolated virtual environment, it is not possible for the user to directly access the port within a docker container from outside. By mapping ports, we instruct docker to pass all the requests to a specific host port to a port inside the container.
> docker run -p <host_port>:<container_port> <container_id>
> docker run -p 8080:80 nginx
Docker Posted May 17, 2020