redis的dockerfile实例:
FROM centos:centos7.9.2009
MAINTAINER xx@xx.com
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#安装YUM源
RUN yum -y install epel-release && yum -y install redis
EXPOSE 6379
#安装清理缓存文件
RUN yum clean all
#修改绑定IP地址
RUN sed -i -e 's@bind 127.0.0.1@bind 0.0.0.0@g' /etc/redis.conf
#关闭保护模式
RUN sed -i -e 's@protected-mode yes@protected-mode no@g' /etc/redis.conf
#设置密码
RUN echo "requirepass 123456" >> /etc/redis.conf
#启动
ENTRYPOINT [ "/usr/bin/redis-server","/etc/redis.conf"]