https://hub.docker.com/_/redis

拉去镜像

  1. docker pull redis

启动

docker run -d -p 6379:6379 --name myredis redis

如需自定义redis.conf,dockerfile

FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

测试

[root@bogon dockerfile]# redis-cli -h 192.168.0.15
192.168.0.15:6379> set a  123
OK
192.168.0.15:6379> get a
"123"

image-20210310102407020.png