여러가지가 필요하다.
certbot certonly --dry-run --webroot --webroot-path=/usr/share/nginx/html
--email [email protected] --agree-tos --no-eff-email --keep-until-expiring -d
fun-coding.xyz -d www.fun-coding.xyz

--dry-run 부분이 중요하다. 여러 블로그에서도 이 부분을 강조하므로 잊지말자. 테스트가 성공하고 나면 해당 부분을 제외하고 실제 인증서를 발급받으면 된다.version: "3"
services:
webserver:
image: nginx:latest
container_name: **proxy**
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./myweb:/usr/share/nginx/html
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./certbot-etc:/etc/letsencrypt
nginx:
image: nginx:latest
container_name: myweb
restart: always
volumes:
- ./myweb:/usr/share/nginx/html
certbot:
depends_on:
- webserver
**image: certbot/certbot # 공식 이미지가 있으므로 가져다 쓰면 된다.**
container_name: certbot
volumes:
- ./certbot-etc:/etc/letsencrypt
- ./myweb:/usr/share/nginx/html
command: certonly --dry-run --webroot --webroot-path=/usr/share/nginx/html --email [email protected] --agree-tos --no-eff-email --keep-until-expiring -d fun-coding.xyz -d www.fun-coding.xyz
webserver)와 내부 웹서버(nginx), 그리고 certobt 까지 총 3개 컨테이너를 사용하게 된다.
certbot 이미지의 command에 위에서 설명한 커맨드가 있는 모습이다.
docker-compose up -d 로 컨테이너를 실행해준 다음,docker logs certbot으로 certbot 컨테이너의 로그를 확인해 준다.
The dry run was successful 이라는 안내가 출력되어 있으면 테스트가 성공한 것이다.