一、查询容器名字
[root@bogon ~]# docker ps
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES
aefea00011c7 registry.docker-cn.com/library/redis:4-alpine "docker-entrypoint.
.." 2 weeks ago Up About an hour 0.0.0.0:6379->6379/tcp myredis
二、进入容器打开Redis测试连通性
[root@bogon ~]# docker exec -it myredis /bin/sh
/data # redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
三、创建key:value测试
127.0.0.1:6379> set ke1 hello
OK
127.0.0.1:6379> get ke1
"hello"
127.0.0.1:6379>
四、退出
127.0.0.1:6379> shutdown