[英]Unable to copy .conf in /etc/supervisor/conf.d/ docker file
I am trying to install supervisor in docker file as follow:我正在尝试在 docker 文件中安装主管,如下所示:
FROM ubuntu:18.04
RUN \
apt-get update && \
apt-get install -y supervisor && \
rm -rf /var/lib/apt/lists/* && \
sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisor/supervisord.conf
VOLUME ["/etc/supervisor/conf.d"]
WORKDIR /etc/supervisor/conf.d
EXPOSE 80 443 5002 5005 22
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
It works.有用。 But once I add following:
但是一旦我添加以下内容:
COPY AppSupervisor.conf /etc/supervisor/conf.d/
before前
EXPOSE 80 443 5002 5005 22
Then docker image build and docker run are successfull but I am unable to see any conatiner with docker ps
然后 docker 映像构建和 docker 运行成功,但我无法看到任何带有
docker ps
的容器
Most probably there might error in supervisor config which leads to exit container.主管配置中很可能存在导致退出容器的错误。
Better to run the container in foreground docker run -it --rm my_image
or check container logs you will find something docker ps -a
and docker logs container_name
.最好在前台运行容器
docker run -it --rm my_image
或检查容器日志,您会发现docker ps -a
和docker logs container_name
。
for test purpose, Changes that will require to work with below example出于测试目的,需要与以下示例一起使用的更改
RUN apt-get update && apt-get install nginx -y
WORKDIR /etc/supervisor/conf.d
COPY supervisor.conf .
Here is the working example that will start Nginx.这是将启动 Nginx 的工作示例。
[program:nginx]
command=nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
autostart=true
priority=1
autorestart=true
exitcodes=0 , 4
startretries = 20
this should work, so correct config file accordingly.这应该有效,因此请相应地更正配置文件。
by running container in the foreground you will see通过在前台运行容器,您将看到
2020-07-31 01:15:09,339 CRIT Supervisor running as root (no user in config file)
2020-07-31 01:15:09,339 INFO Included extra file "/etc/supervisor/conf.d/supervisor.conf" during parsing
2020-07-31 01:15:09,347 INFO RPC interface 'supervisor' initialized
2020-07-31 01:15:09,347 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-07-31 01:15:09,348 INFO supervisord started with pid 1
2020-07-31 01:15:10,351 INFO spawned: 'nginx' with pid 9
2020-07-31 01:15:11,398 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.