Docker Alpine Supervisor unix:///run/supervisord.sock 没有这样的文件

问题描述 投票:0回答:2

我使用 docker、docker-compose 来创建图像,并使用我的应用程序和主管(通过文档 3.3.5)基于 alpine 3.10 创建图像。但是当我进入容器并启动supervisorctl后,我遇到了错误。有人可以帮助我如何解决它吗?

来自 img 的卷

volumes:
    - ./php-consume/supervisord.conf:/etc/supervisord/conf.d/supervisord.conf

还有我的

supervisord.conf

[program:messenger-consume]
command=php /var/www/symfony/bin/console messenger:consume success andraction_parse_row_success --limit=100
numprocs=2
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d

[supervisord]
nodaemon=true

当我进入容器并运行supervisorctl时

ivan@ivan-laptop:~/hosts/docker-symfony$ docker exec -it bc6df01db4db ash
/var/www/symfony # supervisorctl 
unix:///run/supervisord.sock no such file
docker supervisord alpine-linux
2个回答
2
投票

你没有supervisorctl部分。 确保您已将 Supervisors conf 文件复制到 /etc/suervisorsd.conf DockerFile

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY supervisord.conf /etc/supervisord.conf

或者用参数启动它。

DockerFile

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

这是我的典型配置supervisord.conf

[unix_http_server]
file=/dev/shm/supervisor.sock
chmod=0700

[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
childlogdir=/var/log/supervisor

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

[supervisorctl]
serverurl=unix:///dev/shm/supervisor.sock

0
投票

您可以在主管配置中使用 alpine 预定义袜子作为默认值:

supervisord.conf

[unix_http_server]
file=/run/supervisord.sock                  ; (the default path in alpine)
chmod=0700

[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/run/supervisord.pid                ; (supervisord pidfile; in /run)
childlogdir=/var/log/supervisor             ; ('AUTO' child log dir, default $TEMP)

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

[supervisorctl]
serverurl=unix:///run/supervisord.sock      ; (the default path in alpine)

Dockerfile

FROM alpine:3.19

RUN apk add --update supervisor

COPY supervisord.conf /etc/supervisor/supervisord.conf

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
© www.soinside.com 2019 - 2024. All rights reserved.