I'm trying to run sonatype/nexus3 behind jwilder/nginx-proxy with the idea of using it as maven and docker private repo. I'd like to get nginx proxying nexus subdomain to port 8081 of the nexus container and proxying docker subdomain to port 8082 of the same container. Is this possible?
I first, I made the maven part work without problems as nexus.mydomain.com
over TSL using Let's Encrypt certificates:
docker run --restart=always --name nginx -d -p 80:80 -p 443:443 -v /root/certs/:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
docker run --restart=always -d -p 8081:8081 --name nexus -e VIRTUAL_HOST=nexus.mydomain.com -v /root/nexus-data:/nexus-data sonatype/nexus3
Then I realized that to get a docker private repository running I needed to use an additional port. So I created the docker repo on port 8082 and recreated the container using the saved configuration, exposing the new port and with an additional subdomain:
docker run --restart=always -d -p 8081:8081 -p 8082:8082 --name nexus -e VIRTUAL_HOST=nexus.mydomain.com,docker.mydomain.com -v /root/nexus-data:/nexus-data sonatype/nexus3
I have tried overriding nginx configuration mounting a volume on /etc/nginx/vhost.d
with no success. Any clues?