Docker Community Forums

Share and learn in the Docker community.

Creating a container to act as a proxy for a web page running in a separate container, then run them both in docker-compose

I am new to Docker and I am trying to create a basic web page in one container and create a separate container to act as a proxy to handle basic authentication and support a secret token within the url as a second authentication. I was able to use nginx to create a Dockerfile for the contents of the webpage. The only contents in this directory is the index.html file and the Dockerfile. I built this docker image and labeled it as “web”. For the proxy Dockerfile I used a nginx.conf file. Inside the directory for the proxy I have the Dockerfile, the nginx.conf file, cert.pem, and key.pem. I am having trouble setting up the ports to access the web page through the proxy. If someone could help with the address that should be inside the proxy_pass argument it would be greatly appreciated. This image was labeled as proxy when built. I also have the docker-compose file below. All files are able to be built but I can not access the webpage through local host using the proxy. Thank you.