Docker Community Forums

Share and learn in the Docker community.

Connecting to Docker Instance from a VM

I have a VM running CentOS 8 with an application running Oracle 12c in the official docker container. Both are running and hosted on my MacBook.

The VM and the container can ping each other, I can connect to the DB from my host but the app on the VM cannot access the database. Any ideas why this might be happening?

Thank you

Open Oracle VM VirtualBox Manager.
Select the VM used by Docker.
Click Settings -> Network.
Adapter 1 should (default?) be “Attached to: NAT”
Click Advanced -> Port Forwarding.
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.