Hi, sorry about the delayed response.
nginx-proxy allows you to reach multiple containers through a single proxy container, using host headers. This means that you have to use a hostname like http://confluence.bar.com to make the request. This request will reach the nginx-proxy container, which will then match the hostname to another container, and route the request to that.
So, the steps you need to carry out (in order) are as follows:
- Start an nginx-proxy container, and map its port 80 to the host port 80
- Start your application containers, each with a environment variable VIRTUAL_HOST containing the hostname you want that container to be identified by, and another variable called VIRTUAL_PORT containing the port on that container you want to reach.
- Ensure that all the names that you used in the VIRTUAL_HOST variables resolve to the IP address of the docker host. For development/testing, you can do this by making entries in the hosts file on the docker host.
- Access your application using the relevant hostname.
In your case, as far as I can tell, the commands would be:
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
Note that port 80 of the host is mapped to port 80 of the nginx-proxy container.
docker run -v /data/your-confluence-home:/var/atlassian/application-data/confluence --name=“confluence” -d -e VIRTUAL_HOST=confluence.bar.com -e VIRTUAL_PORT=8090 atlassian/confluence-server
Note that no ports are mapped for this; i.e., no
-p is required.
This would depend on which operating system you use. If on linux, edit the file
/etc/hosts to add the following line. If on Windows, edit the file
%windir%\system32\drivers\etc\hosts to add the following line:
confluence.bar.com <ip address of docker host>
Make a requerst to
http://bar.confluence.com, which should resolve to your ip address (default port 80). You should correctly reach the confluence container on port 8090.