使用docker构建supervisor全步骤

1.使用docker build 命令基于Dockerfile文件进行构建supervisor镜像,命令:docker build -t supervisor镜像名 Dockerfile文件放置的位置
Dockerfile文件如下:

FROM centos
MAINTAINER phonecom<18819470615@163.com>

# supervisor配置文件路径
ENV SUPERVISORD_CONF=/etc/supervisord.conf
# supervisor临时文件路径(日志文件、sock文件、pid文件)
ENV SUPERVISORD_TMP_CONF=/tmp/supervisor
# supervisor程序块文件路径,即是[program]块
ENV SUPERVISORD_INCLUDE_FILE=/etc/supervisordfile
# web管理界面的IP
ENV SUPERVISORD_WEB_IP=*
# web管理界面的PORT
ENV SUPERVISORD_WEB_PORT=9001
# web管理界面的账号
ENV SUPERVISORD_WEB_ACCOUNT=admin
# web管理界面的密码
ENV SUPERVISORD_WEB_PASSWORD=adminpass

RUN mkdir -p ${SUPERVISORD_TMP_CONF}
RUN mkdir -p ${SUPERVISORD_INCLUDE_FILE}

RUN yum -y update
RUN yum install -y python-setuptools wget telinit
RUN wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O |python
RUN easy_install supervisor
RUN echo -e "[unix_http_server]\nfile=${SUPERVISORD_TMP_CONF}/supervisor.sock\n[inet_http_server]\nport=${SUPERVISORD_WEB_IP}:${SUPERVISORD_WEB_PORT}\nusername=${SUPERVISORD_WEB_ACCOUNT}\npassword=${SUPERVISORD_WEB_PASSWORD}\n[supervisord]\nlogfile=${SUPERVISORD_TMP_CONF}/supervisord.log\nlogfile_maxbytes=50MB\nlogfile_backups=10\nloglevel=info\npidfile=${SUPERVISORD_TMP_CONF}/supervisord.pid\nnodaemon=false\nminfds=1024\nminprocs=200\n[supervisorctl]\nserverurl=unix://${SUPERVISORD_TMP_CONF}/supervisor.sock\n[include]\nfiles = ${SUPERVISORD_INCLUDE_FILE}/*.ini" > ${SUPERVISORD_CONF}

USER root
EXPOSE 22 80 9001

RUN /usr/sbin/init &
RUN /usr/sbin/telinit &

2.使用docker-compose.yml文件进行启动容器,命令:docker-compose up -d
docker-compose.yml文件如下

version: "2"
services:
  supervisor:
    image: phonecom/supervisor # 这里是构建的镜像名
    ports:
      - "127.0.0.1:9001:9001"
    privileged: true
    command: 
      - /usr/bin/bash
      - -c 
      - |
        supervisord -c /etc/supervisord.conf
        while true;do sleep 100;done

转载于:https://www.cnblogs.com/phonecom/p/10804633.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值