Sets up a container running nginx and docker-gen (previously created separately). docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.
acme-companion is a lightweight companion container for nginx-proxy.
It handles the automated creation, renewal and use of SSL certificates for proxied Docker containers through the ACME protocol.
docker network create reverse-proxy
docker-compose up -d
- nginx-proxy
docker logs -f nginx-proxy
- acme-companion
docker logs -f acme-companion
- 80
- 443
- IPV6 support ready
services:
test-website:
image: nginx:latest
container_name: test-website
restart: always
environment:
- LETSENCRYPT_HOST=domain.com # @TODO: your public DNS name
- VIRTUAL_HOST=domain.com # @TODO: your public DNS name, the same domain as above
- VIRTUAL_PORT=80 # @TODO: port used
networks:
- reverse-proxy # the same network of nginx-proxy and acme-companion
networks:
reverse-proxy:
external: true
docker-compose up -d
The created test-website should automatically have SSL certificate and it's own nginx server configurations