I’m working on setting up my development/deployment pipeline for my ubuntu Droplet. I used the one-click Docker Droplet and have followed the guides Install nginx, Initial Server Setup, and Secure nginx.
Where I get lost is how the Docker container and nginx/nginx server block are tied together. I have my image on Docker Hub, building on changes to my GitHub repo. That works great. I can pull the images onto my server, and run them, but I don’t know how to access them or set them up with a server block.
For example, this guide says I should be able to run a container, map it to port 8080, and access it via http://my-ip:8080 but that doesn’t work for me. Thinking 8080 probably isn’t exposed by default, I allowed it in ufw, restarted ufw, and tried again, but no luck. Trying this, and trying to figure out why it doesn’t work, and if it even should, has left me more confused.
Any input that could help clear up this last piece of the puzzle appreciated.
Thanks!
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,
Can you share the command that you use to start your containers here?
Port 8080 is just an example for the guide, if you bind your containers on different ports, then you would need to use that specific port in your reverse proxy config.
Feel free to share the output of the
docker ps
command here.Regards, Bobby
Yes, I can access containers on port 80 directly, however I was confused that I couldn’t access them over 8080 as it might have indicated a problem with my server setup. One of the per-requisites in your guide is setting up nginx with ufw.
returns
My server block: