So far, we’ve said that containers on bridge networks can only communicate with other containers on the same network. However, you can get around this using port mappings.
What are port mappings?
Port mappings let you map a container to a port on the Docker host. Any traffic hitting the Docker host on the configured port will be directed to the container.