Docker入门(四)- 搭建redis

2017-04-22 20:47

搭建redis

下载redis镜像

➜  docker pull redis:3.2.8
5.7: Pulling from library/mysql
75a822cd7888: Pull complete
b8d5846e536a: Pull complete
b75e9152a170: Pull complete
832e6b030496: Pull complete
fe4a6c835905: Pull complete
c3f247e29ab1: Pull complete
21be3e562071: Pull complete
c7399d6bf033: Pull complete
ccdaeae6c735: Pull complete
713c7d65b0d3: Pull complete
86c18539deb2: Pull complete
Digest: sha256:9dc1cece2974c51a4b95bff634ad2b62d2c1225f825c9947cc403dec4f810a6e
Status: Downloaded newer image for mysql:5.7

部署redis

➜  docker run --name redis3.2.8 -p 7001:6379  -d redis:3.2.8 redis-server --appendonly yes                                                         1 ↵
db6d62ec29e09b5183dc1c216ee57413a87330c122b96330f474eafd8ea83860

查看容器进程

➜  docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
db6d62ec29e0        redis:3.2.8         "docker-entrypoint..."   3 hours ago         Up 16 seconds       0.0.0.0:7001->6379/tcp   redis3.2.8
e41193fe394a        mysql:5.7           "docker-entrypoint..."   6 hours ago         Up 2 hours          0.0.0.0:3307->3306/tcp   mysql5.7

进入redis容器

➜  docker exec -ti db6d62ec29e0 /bin/bash
root@db6d62ec29e0:/data# redis-cli
127.0.0.1:6379>