19.docker部署redis

 

docker部署redis

1.拉取docker redis镜像

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@bogon ~]# docker pull redis
Using default tag: latest
Trying to pull repository docker.io/library/redis ...
latest: Pulling from docker.io/library/redis
6ec7b7d162b2: Pull complete
1f81a70aa4c8: Pull complete
968aa38ff012: Pull complete
884c313d5b0b: Pull complete
6e858785fea5: Pull complete
78bcc34f027b: Pull complete
Digest: sha256:0f724af268d0d3f5fb1d6b33fc22127ba5cbca2d58523b286ed3122db0dc5381
Status: Downloaded newer image for docker.io/redis:latest
[root@bogon ~]#
[root@bogon ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/redis latest ef47f3b6dc11 5 days ago 104 MB
[root@bogon ~]#

2.运行docker redis实例

1
2
3
4
5
6
7
[root@bogon ~]# docker run -d --name myredis -p 9001:6379 redis --requirepass "123456"
b7c436fb3e87480c1b477aaf1f016a4925ff94df01542e45ac67e57aecc37c39
[root@bogon ~]#
[root@bogon ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7c436fb3e87 redis "docker-entrypoint..." 6 seconds ago Up 3 seconds 0.0.0.0:9001->6379/tcp myredis
[root@bogon ~]#

3.连接docker redis实例