Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I have somewhat limited experience with Docker as I much prefer to stick with bare metal or the hypervisor layer (KVM for DigitalOcean), though from that experience, Docker doesn’t bind to a specific IP, IIRC. So connecting to a MongoDB instance that is within a container wouldn’t normally be possible from the Droplet’s public IP by default.
You’d have to setup port forwarding using iptables and forward requests on the host (Droplet) to the container (where MongoDB is) – such as accepting requests on port 27017 (on the Droplet) and then forwarding it to the exposed port on the container (which could be the same port).
You may have the port open on the host (Droplet), but that doesn’t generally translate to a container picking up the connection unless the firewall is configured to forward the request to a specific container. When a request is received, the host node (Droplet) doesn’t have anything running on that port and without the firewall, can’t route accordingly.