Docker Nginx with dynamic modules that automatically add a proxy server for available running containers.
Clone and navigate to current directory:
git clone [email protected]:aprakasa/docker-auto-nginx-proxy && \
cd docker-auto-nginx-proxy
Get nginx template:
curl https://raw.githubusercontent.com/nginx-proxy/nginx-proxy/main/nginx.tmpl > nginx.tmpl
Setup nginx-proxy
network:
docker network create nginx-proxy
Run the container:
docker-compose up -d
Clean up docker:
docker system prune -af
Docker images:
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx-proxy_nginx-proxy latest cdc0409102b3 2 hours ago 24MB
nginxproxy/acme-companion latest c77b599f283d 6 days ago 26.2MB
nginxproxy/docker-gen latest 91c788cb3cb9 6 days ago 17.7MB
Add environment for each container block:
environment:
VIRTUAL_PORT: ${PORT}
VIRTUAL_HOST: ${VIRTUAL_HOST}
LETSENCRYPT_HOST: ${LETSENCRYPT_HOST}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
Add network at docker-compose.yml:
networks:
default:
external:
name: nginx-proxy