docker 安装redis并连接使用该redis

zhoumatoMBP:~ zhou$ docker pull redis

Using default tag: latest
latest: Pulling from library/redis
be8881be8156: Pull complete 
d6f5ea773ca3: Pull complete 
735cc65c0db4: Pull complete 
787dddf99946: Pull complete 
0733799a7c0a: Pull complete 
6d250f04811a: Pull complete 
Digest: sha256:858b1677143e9f8455821881115e276f6177221de1c663d0abef9b2fda02d065
Status: Downloaded newer image for redis:latest
zhoumatoMBP:~ zhou$ /Users/zhou/Library/Containers/com.docker.docker/Data/
-bash: /Users/zhou/Library/Containers/com.docker.docker/Data/: is a directory
zhoumatoMBP:~ zhou$ ls /Users/zhou/Library/Containers/com.docker.docker/Data/
backend.sock        tasks            vpnkit.pcap.sock
docker.sock        vms            vpnkit.port.sock
osxfs.sock        vpnkit.diag.sock
task.lock        vpnkit.eth.sock

查看一下是否成功:

zhoumatoMBP:~ zhou$ docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
redis               latest              4e8db158f18d        8 days ago          83.4MB
zhoumatoMBP:~ zhou$ docker images redis
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
redis               latest              4e8db158f18d        8 days ago          83.4MB

启动镜像:

zhoumatoMacBook-Pro:~ zhou$ docker run -p 6379:6379 -d redis:latest redis-server
30e18792709c1e70ec93007731c80062e603ad01e06795d23d4bc6d4c8cdf3ea

连接并使用redis:

docker exec -ti d0b86 redis-cli

成功
在这里插入图片描述

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 像素格子 设计师:CSDN官方博客 返回首页