Sign inSign up

wangjicheng80/redis

By wangjicheng80

•Updated about 7 years ago

Image
0

403

wangjicheng80/redis repository overview

#version: 2019-8-15

FROM centos:7.5.1804

MAINTAINER Jicheng WANG

#date and time

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#yum

#yum-redis #———————————————————————————————————————————————————————————————————————— #前置GCC编译环境

RUN ["yum","-y","update"]

RUN ["yum","-y","install","gcc"]

#应该采用类似数组的方式进行传递命令 非数组形式 会在命令前 /bin/sh -c 运行,会出现很多问题因为sh简化版,跑脚本会出现很多莫名其妙的error 因为是测试就先简化写了

#玄学前置 ubuntu 不需要 centos 需要epel-release

RUN yum install -y epel-release

#redis 安装 固定版本5.0.0 为例子

RUN yum install -y gcc

RUN yum install -y wget

RUN wget download.redis.io/releases/redis-5.0.0.tar.gz #————————————————————————————————————————————————————————————————————————

#install redis5.0 #———————————————————————————————————————————————————————————————————————— #也可以先下载在宿主机上然后ADD ADD的时候会自动解压

#挂载后进行解压也是可以的

RUN tar -zxvf redis-5.0.0.tar.gz -C /usr/local/ && rm -f redis-5.0.0.tar.gz

RUN yum install -y make

RUN cd /usr/local/redis-5.0.0/ && make MALLOC=libc

##########修改配置开启远程连接,关闭保护模式##########

##########不应该开启后台进程运行模式,用后台启动会导致容器退出##########

RUN sed -i -e 's@bind 127.0.0.1@bind 0.0.0.0@g' /usr/local/redis-5.0.0/redis.conf
&& sed -i -e 's@protected-mode yes@protected-mode no@g' /usr/local/redis-5.0.0/redis.conf #&& sed -i -e 's@daemonize no@daemonize yes@g' /usr/local/redis-5.0.0/redis.conf

##########设置密码##########

RUN echo "requirepass your-passwd" >> /usr/local/redis-5.0.0/redis.conf

#multi-redis.conf

RUN mv /usr/local/redis-5.0.0/redis.conf /usr/local/redis-5.0.0/6379.conf

RUN cp -p /usr/local/redis-5.0.0/6379.conf /usr/local/redis-5.0.0/6380.conf

#edit-6380.conf

RUN sed -i -e 's@port 6379@port 6380@g' /usr/local/redis-5.0.0/6380.conf

RUN sed -i -e 's@redis_6379.pid⁠@redis_6380.pid@g' /usr/local/redis-5.0.0/6380.conf #————————————————————————————————————————————————————————————————————————

#yum-tools #———————————————————————————————————————————————————————————————————————— RUN yum -y install vim

RUN yum -y install telnet

RUN yum -y install openssl

RUN yum -y install net-tools

RUN yum -y install supervisor

RUN yum -y install openssh-server #————————————————————————————————————————————————————————————————————————

#clean yum

RUN yum clean all

#EXPOSE port

EXPOSE 6379 6380 22

#ssh #———————————————————————————————————————————————————————————————————————— RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config

RUN echo "root:ljs-ICP15011392" | chpasswd

RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

RUN mkdir /var/run/sshd #————————————————————————————————————————————————————————————————————————

#supervisor #———————————————————————————————————————————————————————————————————————— COPY supervisord.conf /etc/supervisord.conf

#start-server

#ENTRYPOINT [ "/usr/bin/redis-server","/etc/redis/6379.conf"]

CMD ["/usr/bin/supervisord"] #————————————————————————————————————————————————————————————————————————

################################################################################################################

#supervisord.conf #no dockerfile contents #COPY supervisord.conf /etc/supervisord.conf #———————————————————————————————————————————————————————————————————————— [supervisord] nodaemon=true

[program:sshd] command=/usr/sbin/sshd -D

[program:redis-6379] command=/usr/local/redis-5.0.0/src/redis-server /usr/local/redis-5.0.0/6379.conf

[program:redis-6380] command=/usr/local/redis-5.0.0/src/redis-server /usr/local/redis-5.0.0/6380.conf #————————————————————————————————————————————————————————————————————————

Tag summary

Content type

Image

Digest

Size

755.9 MB

Last updated

about 7 years ago

docker pull wangjicheng80/redis:v35