[root@localhost redis]# cat Dockerfile
FROM centos
RUN yum install epel-release -y
RUN yum update -y
RUN yum install redis -y
EXPOSE 6379
ENTRYPOINT ["/usr/bin/redis-server"]
构建镜像
docker build -t centos/redis .
启动镜像
docker run -tid -p 6379 --name myredis centos/redis --requirepass "123456"
requirepass:为redis的密码
查看刚刚创建的容器端口为32777
docker ps -l
作者:Mariana_
链接:https://www.jianshu.com/p/d2e2909c385f