Mac的docker安装redis

Mac的docker安装redis

bash 复制代码
NAME                                DESCRIPTION                                      STARS     OFFICIAL   AUTOMATED
redis                               Redis is an open source key-value store that...   12205     [OK]       
redislabs/redisearch                Redis With the RedisSearch module pre-loaded...   56                   
redislabs/redisinsight              RedisInsight - The GUI for Redis                 88                   
redislabs/rebloom                   A probablistic datatypes module for Redis        23                   [OK]
redislabs/redis                     Clustered in-memory database engine compatib...   38                   
redis/redis-stack-server            redis-stack-server installs a Redis server w...   47                   
redislabs/rejson                    RedisJSON - Enhanced JSON data type processi...   53                   
redis/redis-stack                   redis-stack installs a Redis server with add...   59                   
redislabs/redisgraph                A graph database module for Redis                26                   [OK]
redislabs/redismod                  An automated build of redismod - latest Redi...   41                   [OK]
redislabs/redistimeseries           A time series database module for Redis          12                   
redislabs/operator                                                                   7                    
redislabs/operator-internal         This repository contains pre-released versio...   1                    
redislabs/redis-py                                                                   5                    
redislabs/redis-webcli              A tiny Flask app to provide access to Redis ...   3                    [OK]
redislabs/redisgears                An automated build of RedisGears                 4                    
redislabs/k8s-controller-internal                                                    0                    
redislabs/memtier_benchmark         Docker image to run memtier_benchmark            0                    
redislabs/ng-redis-raft             Redis with redis raft module                     0                    
redislabs/k8s-controller                                                             2                    
redislabs/redisai                                                                    5                    
redislabs/olmtest                   Test artefact for OLM CSV                        0                    
bitnami/redis                       Bitnami Redis Docker Image                       259                  [OK]
redislabs/olm-bundle                                                                 0                    
redislabs/redisml                   A Redis module that implements several machi...   3                    [OK]

2、docker pull redis

bash 复制代码
macdeMacBook-Pro:~ mac$ docker pull redis
Using default tag: latest
latest: Pulling from library/redis
faef57eae888: Pull complete 
bb595d48e52d: Pull complete 
d479b54c3bb2: Pull complete 
2044989c541a: Pull complete 
01e4ba5495fa: Pull complete 
ed7a9fd4b0ea: Pull complete 
Digest: sha256:08a82d4bf8a8b4dd94e8f5408cdbad9dd184c1cf311d34176cd3e9972c43f872
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest

What's Next?
  View summary of image vulnerabilities and recommendations → docker scout quickview redis

3、添加两个映射目录

bash 复制代码
mkdir /Users/mac/docker/redis/conf/redis.conf
mkdir /Users/mac/docker/redis/data

4、运行

bash 复制代码
docker run --name redis -p 6379:6379 -v /Users/mac/docker/redis/conf/redis.conf:/etc/redis/redis.conf -v /Users/mac/docker/redis/data:/data -d redis redis-server /etc/redis/redis.conf 

5、查看日志

或者

bash 复制代码
macdeMacBook-Pro:redis mac$ docker logs -f redis
1:C 13 Jul 2023 13:47:33.118 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 13 Jul 2023 13:47:33.118 # Redis version=7.0.12, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 13 Jul 2023 13:47:33.118 # Configuration loaded
1:M 13 Jul 2023 13:47:33.119 * monotonic clock: POSIX clock_gettime
1:M 13 Jul 2023 13:47:33.120 * Running mode=standalone, port=6379.
1:M 13 Jul 2023 13:47:33.120 # Server initialized
1:M 13 Jul 2023 13:47:33.121 * Ready to accept connections
1:M 13 Jul 2023 13:48:07.372 # Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection aborted.

6、为redis设置密码

bash 复制代码
#1.进入redis的容器
docker exec -it 容器ID bash

cd /usr/local/bin

# redis-cli
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) ""
127.0.0.1:6379> config set requirepass 123456
OK
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) "123456"

7、测试:

bash 复制代码
127.0.0.1:6379> set ycz "abc"
OK
127.0.0.1:6379> get ycz
"abc"
相关推荐
南猿北者1 小时前
docker容器
docker·容器
二十雨辰1 小时前
[linux]docker基础
linux·运维·docker
time never ceases2 小时前
使用docker方式进行Oracle数据库的物理迁移(helowin/oracle_11g)
数据库·docker·oracle
水月梦镜花3 小时前
redis:list列表命令和内部编码
数据库·redis·list
MonkeyKing_sunyuhua4 小时前
ubuntu22.04 docker-compose安装postgresql数据库
数据库·docker·postgresql
Java小白笔记4 小时前
Mac中安装homebrew
macos
掘金-我是哪吒4 小时前
微服务mysql,redis,elasticsearch, kibana,cassandra,mongodb, kafka
redis·mysql·mongodb·elasticsearch·微服务
追风林4 小时前
mac m1 docker本地部署canal 监听mysql的binglog日志
java·docker·mac
€☞扫地僧☜€5 小时前
docker 拉取MySQL8.0镜像以及安装
运维·数据库·docker·容器
茶馆大橘5 小时前
微服务系列六:分布式事务与seata
分布式·docker·微服务·nacos·seata·springcloud