Report this

What is the reason for this report?

How do I expose a Docker container to the internet on my Droplet?

Posted on March 24, 2025

I’m running a Docker container on my DigitalOcean Droplet and I want to expose it to the internet so I can access it via my domain or public IP.

What’s the proper way to do this? Should I use -p flags or set up Nginx as a reverse proxy?

Just want to make sure I’m doing it the right way.



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.

Hey there 👋

Great question! The easiest way to expose your Docker container is by using the -p flag when running your container. For example:

docker run -d -p 80:80 your-image

That maps port 80 on your Droplet to port 80 in your container, so you can access it via your Droplet’s public IP.

If you want to expose multiple services or use a domain name, setting up Nginx as a reverse proxy is a solid option, gives you more flexibility and makes it easier to manage multiple containers behind one domain.

Check out this video here for more details:

Also, if you’re just getting started with Docker, feel free to check out this free eBook here: 👉 Introduction to Docker Free eBook

Hope that helps!

- Bobby

Heya, @6e913a726e3b411f8664012c7eb00c

Really good question here. The proper way depends on your use case — but generally, for production or multi-app setups, you should use NGINX as a reverse proxy.

Hope that this helps!

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.