What IP address can I use when on Windows machines for an IP of a Docker Container running within a VM on Virtual Box?
I have:
- Windows 10 Machine with
- Virtualbox installed with Ubuntu VM
- that has Docker installed
- and a container running with ports 80/443
On the VM I can run docker commands and see container running
vagrant@ubuntu-xenial:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7a41b3edecd nrel/api-umbrella "api-umbrella run" 17 minutes ago Up 17 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp api-umbrella
vagrant@ubuntu-xenial:~$
The IP of that container is:
vagrant@ubuntu-xenial:~$ docker inspect e7a41b3edecd | grep "IPAddress"
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
vagrant@ubuntu-xenial:~$
I can the ping IP 172.17.0.2 and curl http://172.17.0.2 on the VM itself. But when trying http://172.17.0.2 on Windows machines I have not response.
QUESTION - What IP do I use from Windows machine to get at the Docker container running on the VM?
docker inspect
to look them up: they're not routable in situations like what you're encountering and there are better ways to reach the containers. – David Mazedocker run -p
or the Docker Composeports:
directive (as in @BrayanCaldera's answer) and connect to the VM's IP address (as in @HanaAlaydrus's answer) on the published port. – David Maze