How to Ping a docker container from outside the host (same network)

After creating an app in a docker container, you are bound to cross to a problem on wanting to access the containerized website or application outside the host. In this guide, you will know how to ping a docker container or the containerized website you are hosting outside the host.

1. Close the Virtual Machine and open Oracle VM VirtualBox Manager.

2. Select the VM used by Docker

3. Click Settings -> Network

Adapter 1 should in be default “Attached to: NAT”

4. Click Advanced -> Port Forwarding

5. Add rule: Protocol TCP, Host Port 8080, Guest Port 8080 (leave Host IP and Guest IP empty)

Guest is your docker container and Host is your machine

You can now browse to your container via localhost:8080 and your-internal-ip:8080.

Leave a Comment

Your email address will not be published. Required fields are marked *