supervisor.sock refused connection in docker conta

2019-06-16 16:05发布

问题:

supervisor.sock refused connection in docker container

I have tried to fix it by supervisorctl unix:///var/run/supervisor.sock refused connection AND Overlayfs does not work with unix domain sockets

However, it still does not work in 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 have tried execute

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

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

How to fix it and let supervisor run in container?