一个dockerfile文件编写构建redis镜像
FROM centos:7
RUN curl -s -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
RUN yum install wget -y && yum -y install gcc make
RUN mkdir /app
WORKDIR /app
RUN wget http://mirrors.huaweicloud.com/redis/redis-5.0.7.tar.gz
RUN cd /app && tar -zxvf redis-5.0.7.tar.gz
RUN yum install jemalloc-devel gcc-c++ gcc tcl-devel -y \
&& yum install epel-release -y \
&& yum clean all && yum makecache \
&& mv redis-5.0.7 redis \
&& cd /app/redis/ \
&& make && make PREFIX=/app/redis install
EXPOSE 6379
VOLUME /app/redis/
RUN sed -i 's#daemonize no#daemonize yes#g' /app/redis/redis.conf
RUN sed -i 's#bind 127.0.0.1#bind 0.0.0.0#g' /app/redis/redis.conf
RUN sed -i 's#protected-mode yes#protected-mode no#g' /app/redis/redis.conf
CMD cd /app/redis/bin && ./redis-server ../redis.conf
评论区