Docker中使用supervisor管理开机自启动(redis && sshd)
1、Centos安装Redis参考http://blog.csdn.net/lsziri/article/details/693891872、Dockerfile# Docker for CentOS 7#Base imageFROM hfq/centos7:JurassicRUN \wget http://download.redis.io/re
·
1、Centos安装Redis参考
http://blog.csdn.net/lsziri/article/details/69389187
2、Dockerfile
# Docker for CentOS 7
#Base image
FROM hfq/centos7:Jurassic
RUN \
wget http://download.redis.io/releases/redis-3.2.8.tar.gz && tar xzf redis-3.2.8.tar.gz \
&& cd redis-3.2.8 && yum -y install tcl && make && make install \
&& mkdir -p /etc/redis/
#安装supervisor=============================重点=================================
RUN yum -y install python-setuptools
RUN easy_install supervisor
ADD redis.conf /etc/redis/redis.conf
ADD supervisord.conf /etc/supervisord.conf
EXPOSE 6379
EXPOSE 12007
CMD /usr/bin/supervisord -c /etc/supervisord.conf
###############################################构建脚本####################################
#构建image镜像
#docker build -t hfq/centos7:IceAge .
#启动container后台运行提供sshd服务
#docker run -d -P --name <container name> hfq/centos7:IceAge
#进入sshd启动的container
#docker exec -it <container name or id> /bin/bash
#docker rm $(docker ps -a | grep "xxx/jedi:v5" | awk '{print $1}')
#操作记录
#docker run -d -P --name hfq-jedi-smq-IceAge hfq/centos7:IceAge
3、开启启动配置supervisord.conf
[supervisord]
nodaemon=true
[program:sshd]
command=/usr/sbin/sshd -D
autostart=true
autorestart=true
[program:redis]
command=/usr/local/bin/redis-server /etc/redis/redis.conf
更多推荐
已为社区贡献5条内容
所有评论(0)