Configuration使用绝对路径启动参数-c指定配置supervisord.conf的绝对路径。比如Dockerfile在最后写:ENTRYPOINT["/usr/bin/supervisord","-c","/etc/supervisor/supervisord.conf"]多个启动项配置文件统一目录如/etc/supervisor/conf.d/,和supervisord.conf中的includeheredirectory[include]files=/etc/supervisor/conf.d/*.conf各个启动项日志统一放到该目录下,如:/tmp/xxx_stdout.log,并设置日志滚动大小和保留副本supervisord配置需要配置nodaemon=true,默认输出到dockersupervisorctl并由httpserver管理,这个涉及到一个dockeroverlayfsunixsockets的问题,无法管理启动项,我不不知道现在能不能解决[inet_http_server]port=127.0.0.1:9001username=userpassword=123[supervisorctl]serverurl=http://127.0.0.1:9001username=userpassword=123缺点是多监听一个本地端口,注意不要和应用程序端口冲突。:[program:xxx]command=sh/xxx.shstartretries=0autorestart=false为非root用户启动传递环境变量,需要在容器启动时读取环境变量(env)传递,写入新的ENTRYPOINT脚本到获取环境变量,写入回车文件,最后运行supervisord$catDockerfileENTRYPOINT["/entrypoint.sh"]$cat/entrypoint.sh获取环境变量,写入配置,或者拼接完整命令/usr/bin/supervisord-cxx.confrestartorrestart加载配置并kill-HUP1inthecontainer-EOF-更多技术资料请关注:gzitcast
