Hey everyone! I'm new to Docker and I'm currently working on a personal project where I need to set up four containers using the Nginx image. I'm trying to configure them to work as a reverse proxy, but I'm having trouble accessing it after the setup. All containers are on the same network and I'm following the official Nginx documentation. Any help would be greatly appreciated!
5 Answers
You might also want to consider using a different reverse proxy, like Caddy or Traefik. They have some additional features that might make your setup easier.
Have you checked if your Nginx container can resolve the names of the other containers or reach them by IP address? Make sure everything that Nginx needs to proxy is within the same network.
For reverse proxy solutions, I've had great success with SWAG (Secure Web Application Gateway). It comes prepackaged with Nginx, has SSL cert auto-renewal, and includes security features like fail2ban and great sample configs. I’ve even written some in-depth guides on it you might find useful! Check them out here: corelab.tech/setupcompose/ and corelab.tech/nginxpt2/.
Keep in mind that if you restart a container, its IP address will change, and Nginx might not recognize it anymore. You could set static IP addresses for your containers to avoid this issue.
It would be helpful if you could share your Docker Compose YAML file and Nginx configuration using something like Pastebin or GitHub Gist. That way, we can help troubleshoot more effectively!

Thanks for the tip! I hadn't thought about that. I’ll look into setting static IPs.