Supervisor.sock refused connection in docker container

supervisor.sock refused connection in Docker container

I tried to fix this with supervisorctl unix: ///var/run/supervisor.sock refused connection And Overlayfs does not work with unix domain sockets

However, it still does not work on my debain server.


Here is my docker_supervisor.conf

FROM python:2.7

RUN pip install supervisor

RUN mkdir /app
WORKDIR /app

COPY docker_supervisor.conf /app

RUN supervisord -c docker_supervisor.conf

CMD ["supervisorctl", "-c", "docker_supervisor.conf", "restart", "apiapp:"]

Here is docker_supervisor.conf

[unix_http_server]
file=/var/run/docker_supervisor.sock
chown=root:root
chmod=0777

[supervisord]
logfile=/var/run/docker_supervisor.log
pidfile=/var/run/docker_supervisor.pid

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = 
supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/docker_supervisor.sock

[group:apiapp]
programs=api_web

[program:api_web]
user=root
directory=/app
command=python echo "OKOKOK"

sudo docker build --no-cache -t test .
Successfully built c3b4061fc9f7


sudo docker run -v $(pwd):/app test
unix:///var/run/docker_supervisor.sock refused connection

I tried to execute

sudo docker run --tmpfs /var/run -v $(pwd):/app test

But it gets the same result: "unix: ///var/run/docker_supervisor.sock connection refused"

How to fix this and run the supervisor in the container?

+8
source share
1

, /dev/shm/supervisor.sock /dev/shm/supervisor.sock.

supervisord.conf :

[unix_http_server]
file=/dev/shm/supervisor.sock                 ; <-- change it here
chmod=0700

[supervisord]
nodaemon=true                                 ; <-- add nodaemon for Docker
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///dev/shm/supervisor.sock     ; <-- and change it here too

[program:app]
...

. supervisorctl -c , . /var/run/supervisor.sock .

:

0

Source: https://habr.com/ru/post/1676226/


All Articles