docker search redis查看,或者登录网站查看
[root@localhost ~]# docker search redis
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source key-value store that… 12522 [OK]
bitnami/redis Bitnami Redis Docker Image 271 [OK]
redislabs/redisinsight RedisInsight - The GUI for Redis 94
redis/redis-stack redis-stack installs a Redis server with add… 85
redis/redis-stack-server redis-stack-server installs a Redis server w… 62
redislabs/redisearch Redis With the RedisSearch module pre-loaded… 61
redislabs/rejson RedisJSON - Enhanced JSON data type processi… 53
redislabs/redismod An automated build of redismod - latest Redi… 41 [OK]
redislabs/redis Clustered in-memory database engine compatib… 40
redislabs/redisgraph A graph database module for Redis 26 [OK]
redislabs/rebloom A probablistic datatypes module for Redis 25 [OK]
redislabs/redistimeseries A time series database module for Redis 12
redislabs/operator 7
redislabs/redisai 6
redislabs/redis-py 5
redislabs/redis-webcli A tiny Flask app to provide access to Redis … 5 [OK]
redislabs/redisgears An automated build of RedisGears 4
redislabs/redisml A Redis module that implements several machi… 3 [OK]
redislabs/k8s-controller 2
redislabs/operator-internal This repository contains pre-released versio… 1
redislabs/olmtest Test artefact for OLM CSV 1
redislabs/ng-redis-raft Redis with redis raft module 0
redislabs/k8s-controller-internal 0
redislabs/olm-bundle 0
redislabs/memtier_benchmark Docker image to run memtier_benchmark 0
[root@localhost ~]# docker pull redis:5.0.8
5.0.8: Pulling from library/redis
123275d6e508: Pull complete
f2edbd6a658e: Pull complete
66960bede47c: Pull complete
533694cb3638: Pull complete
1dc100dcb2f1: Pull complete
9ca9ac709269: Pull complete
Digest: sha256:96bdb5e2984b15e3cf4de74077f650c911cb26ec0981e0772df35a1a5cb19798
Status: Downloaded newer image for redis:5.0.8
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis 5.0.8 975fe4b9f798 3 years ago 98.3MB
docker挂载配置文件
接下来就是要将redis 的配置文件进行挂载,以配置文件方式启动redis 容器。(挂载:即将宿主的文件和容器内部目录相关联,相互绑定,在宿主机内修改文件的话也随之修改容器内部文件)
1)、挂载redis的配置文件
2)、挂载redis 的持久化文件(为了数据的持久化)。
配置文件路径例如:
[root@localhost ~]# mkdir -p /home/redis/redis5.0.8
[root@localhost ~]# cd /home/redis/redis5.0.8/
[root@localhost redis5.0.8]# mkdir data
[root@localhost redis5.0.8]#
[root@localhost redis5.0.8]# ls
data redis.conf
redis.conf 可以通过官网下载
docker run --restart=always -p 6378:6378 --name redis5.0.8 \
-v /home/redis/redis5.0.8/data:/data \
-v /home/redis/redis5.0.8/redis.conf:/etc/redis/redis.conf \
-d redis:5.0.8 \
redis-server /etc/redis/redis.conf --requirepass Admin_123
[root@localhost redis5.0.8]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3e30b4ca313c redis:5.0.8 "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 0.0.0.0:6378->6378/tcp, 6379/tcp redis5.0.8
docker logs --since 30m redis5.0.8
[root@localhost redis5.0.8]# docker exec -it redis5.0.8 redis-cli -p 6378
docker restart redis
docker ps -a
docker stop <容器名>
docker rm <容器名>
docker images # 查看所有镜像
docker rmi <IMAGE ID> #删除