version: '3' services: nginx-terminate: image: nginx:alpine restart: unless-stopped volumes: - ./data/nginx-terminate/nginx.conf:/etc/nginx/nginx.conf:Z - ./data/certbot/conf:/etc/letsencrypt:Z - ./data/certbot/www:/var/www/certbot:Z ports: - "443:443" - "80:80" command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; /usr/sbin/nginx -s reload; done & /usr/sbin/nginx -c /etc/nginx/nginx.conf -g \"daemon off;\"'" nginx-relay: image: nginx:alpine restart: unless-stopped volumes: - ./data/nginx-relay/nginx.conf:/etc/nginx/nginx.conf:Z command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; /usr/sbin/nginx -s reload; done & /usr/sbin/nginx -c /etc/nginx/nginx.conf -g \"daemon off;\"'" certbot: image: certbot/certbot restart: unless-stopped volumes: - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"