Question

Docker image deployment in VPC

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


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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