[root@Tseng-HW ~]# docker pull redis:6.0.6
……………………
[root@Tseng-HW ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis 6.0.6 1319b1eaa0b7 2 years ago 104MB
[root@Tseng-HW ~]#
创建data目录
[root@Tseng-HW data]# mkdir -p /data/redis/data
创建
[root@Tseng-HW ~]# docker run -d -p 16379:6379 --restart=always --name=redis0309 --volume=/data/redis/data:/data redis:6.0.6 --appendonly yes --requirepass qcd2023
4376893fb83ad7152a069161df48bb93af26304167355d7d6d5b948e9d56423b
[root@Tseng-HW ~]#docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4376893fb83a redis:6.0.6 "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 0.0.0.0:6339->6379/tcp, :::6339->6379/tcp redis0309