Hi there,
I have the following construction: Server 1 (mongod + app) and server 2 (just the app) Both run their app inside Docker. I enabled private networking for both servers, and they are in the same region.
What I want to do is access the DB that’s installed on server, on server 2 using the private IP of server 1. I can do this without Docker but not inside.
I currently use the public (external) IP address. Does anyone know how to make this work? Thanks!
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!
You may need to specify the IP address when using the docker command to launch your container. instead of just adding a mapping of container port to host port you can also specify the IP address (in this case the host’s private IP).
docker run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.