1、拉取redis
docker pull redis
返回以下信息表示成功
Using default tag: latest
latest: Pulling from library/redis
6ae821421a7d: Already exists
e3717477b42d: Pull complete
8e70bf6cc2e6: Pull complete
0f84ab76ce60: Pull complete
0903bdecada2: Pull complete
492876061fbd: Pull complete
Digest: sha256:dd5b84ce536dffdcab79024f4df5485d010affa09e6c399b215e199a0dca38c4
Status: Downloaded newer image for redis:latest
2、创建目录
创建redis目录
mkdir redis
创建data目录
cd redis/
mkdir data
2、创建容器
docker run --name redis -p 6379:6379 -d -v /usr/local/server/redis/data:/data redis redis-server --appendonly yes
执行
docker ps -a
查看容器创建情况
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7428490a438d redis "docker-entrypoint.s…" 7 seconds ago Up 5 seconds 0.0.0.0:6379->6379/tcp redis
--requirepass "angel83528358"
--restart=always
网友评论