Host access to docker container ports

Linux

If you run docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name_or_id> or simply run docker inspect <container id> and scan through the json output and look for the host ID

You will get the IP address of the container. You can then use this to bind to the port from the host.

You can also just use 0.0.0.0:<port #>

Windows 10

If you run docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name_or_id> or simply run docker inspect <container id> and scan through the json output and look for the host ID

You will get the IP address of the container.

You would expect this to work but it fails, you have to use the machine's IP address which can be found by using docker-machine inspect - by default it seems to 192.168.99.100

This does work!!!