$ make ps
docker-compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
prd-nginx-1 docker.io/library/nginx:latest "nginx -g daemon off;" nginx 20 minutes ago Up 20 minutes
↑ 20分前にnginx が起動している
nginx 設定ファイル文法チェック
$ make test
docker-compose exec nginx nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx 設定再読み込み
$ make reload
docker-compose exec nginx nginx -s reload
これらを組み合わせることで運用に必要な作業を簡易に行うことができる。
nginx のバージョンアップは、make down make prune make up にて行える。
サービス増加やSSL 証明書更新後は、make test を行い、success が確認できたらmake reload を行う。make test を行う前に再起動を行うと、もし設定に誤りがあったら起動できなくなる。