Report this

What is the reason for this report?

Docker image deployment in VPC

Posted on August 29, 2021

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!

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.

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

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.