LoginSignup
5
5

More than 5 years have passed since last update.

Dockerでsupervisorctlを使おうとしたら「unix:///var/run/supervisor.sock refused connection」となる

Last updated at Posted at 2017-06-28

もともとsupervisordを使っていたDockerコンテナを、新しいサーバに移行したらsupervisorctlが使えなくなった...

「docker exec -it hoge supervisorctl status」を実行すると

unix:///var/run/supervisor.sock refused connection

と出る!
(supervisordは起動しているようだが、supervisorctlが使えないので、supervisordを使って稼働させているプロセスの停止などができなくなっている...)

正常に稼働していたDocker、supervisordのバージョンは以下

Docker : 1.9.1, build a34a1d5
supervisord : 3.0

上記のエラーが発生したDocker、supervisordのバージョンは以下

Docker : 1.9.1, build a34a1d5
supervisord : 3.0

unix:///var/run/supervisor.sock refused connectionが発生するバージョンは

Docker : 17.03.1-ce, build c6d412e
supervisord : 3.0 (変えてない)

試したこと

調べつつ以下を試した

Docker起動時、tmpfsオプションを指定する

--tmpfs /var/run/

Docker起動時オプションで上記を設定してみた → エラー解消せず...

unixソケットではなくinetソケットを使ってみる

supervisord.conf を以下の感じで修正してみた

[inet_http_server]
port=127.0.0.1:9001

[supervisorctl]
serverurl=http://127.0.0.1:9001

→ エラー解消せず...

supervisordの設定の「/var/run」を「/dev/shm」 に変更する

こんな感じでconfファイルの全ての記載を/dev/shmに変更

sed -i "s/\/var\/run/\/dev\/shm/g" /etc/supervisor/supervisord.conf

→ supervisorctl使えるようになりました

docker exec -it hoge supervisorctl status
cron                          RUNNING    pid 9, uptime 0:05:12
laravelqueue:hogequeue        RUNNING    pid 78, uptime 0:00:09
php-fpm                       RUNNING    pid 10, uptime 0:05:12

参考

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5