How to access host port from docker container? To access a port on the host machine from inside a Docker container, you can use the -p option when running the container to map the host port to a port in the container.