docker安裝redis

docker pull redis
docker run --name hbk_redis -p 6379:6379 -d redis

查看進程redis

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
03fb79f1456d        redis               "docker-entrypoint..."   4 seconds ago       Up 3 seconds        0.0.0.0:6379->6379/tcp              hbk_redis

進入終端docker

[root@localhost ~]# docker exec -it 03fb79f1456d /bin/bash
root@03fb79f1456d:/data# redis-cli
127.0.0.1:6379> set name huangbaokang
OK
127.0.0.1:6379> get name
"huangbaokang"
相關文章
相關標籤/搜索