dockerコンテナ内では、 systemctl や service コマンドが利用できません。
いつものクセでコンテナ化していない環境と同じコマンドを実行するとエラーします。
# / systemctl status nginx
sh: systemctl: not found実行プロセスの有無で起動状態かそうでないかを判断する
代わりの方法として、プロセスがあるかどうかで判断をしてみます。
# / ps r | grep nginx
    1 root      0:00 nginx: master process nginx -g daemon off;
  101 nginx     0:00 nginx: worker process
  102 nginx     0:00 nginx: worker process
  103 nginx     0:00 nginx: worker process
  104 nginx     0:00 nginx: worker process
  106 root      0:00 grep nginxrオプションで実行中のプロセスの一覧を表示し、grepでnginxのものだけを絞り込みます。
プロセスがあればNginxが起動していて、何も表示されなければNginxが起動していない…と考えることができます。
以上、あなたのお役に立てれば嬉しいです。
最近のコメント