简体   繁体   English

无法在 /etc/supervisor/conf.d/docker 文件中复制.conf

[英]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 -adocker 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.

相关问题 无法在 nginx /etc/nginx/conf.d/default.conf 中复制配置文件 - Unable to COPY config file in nginix /etc/nginx/conf.d/default.conf docker-compose up由于COPY conf.d / * /etc/nginx/conf.d无法正常工作而失败 - docker-compose up is failing becuase of COPY conf.d/* /etc/nginx/conf.d is not working docker (windows10 wsl2) 无法挂载。/nginx/conf.d:/etc/nginx/conf.d - docker (windows10 wsl2) unable to mount ./nginx/conf.d:/etc/nginx/conf.d 使用 docker 和 nginx 部署的 React 应用程序:/etc/nginx/conf.d/default.conf 与包不同 - React app deployed with docker and nginx : /etc/nginx/conf.d/default.conf differs from the packages 运行独立 docker 容器时,在 /etc/nginx/conf.d/nginx.conf 上游中找不到主机 - host not found in upstream in /etc/nginx/conf.d/nginx.conf when running standalone docker containers Docker主管-无法找到supervisor.conf文件 - Docker supervisor - unable to find supervisor.conf file Percona 5.6 Docker Image 无法加载我的 /etc/mysql/conf.d/*.cnf - Percona 5.6 Docker Image cannot load my /etc/mysql/conf.d/*.cnf 无法启动 nginx-proxy docker 映像并显示错误“/etc/nginx/conf.d/default.conf 的内容未更改” - Couldn't start nginx-proxy docker image with error “Contents of /etc/nginx/conf.d/default.conf did not change” Docker 撰写错误:nginx:在 /etc/nginx/conf.d/default.conf:21 的上游“应用程序”中找不到 [emerg] 主机 - Docker compose error: nginx: [emerg] host not found in upstream “app” in /etc/nginx/conf.d/default.conf:21 为什么“ RUN rm /etc/nginx/conf.d/default.conf”没有成功? - Why “RUN rm /etc/nginx/conf.d/default.conf” did not succeed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM