By rajat499
I have my database in VPC and I want to deploy an APP inside the VPC via docker image which can connect to the database in the VPC network, but it should be able to listen to public traffic on http port 80. Can someone please guide on how to do it with digital ocean. I am pretty new to cloud deployments. 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!
Hi there,
I think that, in your case, one approach you could use the --network host flag so that your Docker container networking uses the host network, as per the documentation here:
https://docs.docker.com/network/network-tutorial-host/
The command that you could use would look like this:
docker run --rm -d --network host --name my_nginx nginx
That way your container will have access to both the VPC network and the public network.
Hope that this helps. Best, Bobby
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.