当前位置:网站首页>docker安装redis
docker安装redis
2022-06-26 08:38:00 【aserendipper】
1、搜索Redis镜像,或者从官网中查询所需镜像
docker search redis
2、选择需要下载的镜像拉取到本地,默认会下载最新版本镜像
docker pull redis
3、因为redis默认配置只能够本地连接,不能远程访问,因此需要手动挂载redis配置文件,在本机新建data和conf文件夹以及redis的配置文件
mkdir /docker/redis/data
mkdir /docker/redis/conf
cd /docker/redis/conf
vi redis.conf
#注释掉使redis可以外部访问
#bind 127.0.0.1
#以守护线程的方式启动
daemonize no
#设置密码
requirepass 123456
#redis开启持久化
appendonly yes
#防止出现远程主机强迫关闭现有连接的错误 默认300
tcp-keepalive 300
4、创建redis容器并启动
docker run --name redis -p 6379:6379 -v /docker/redis/data:/data -v /docker/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
- docker run:运行容器
- –name redis:容器名称
- -p 6379:6379:将主机的6379端口(冒号前)映射到容器的6379端口(冒号后)
- -v /docker/redis/data:/data:将主机的/docker/redis/data目录挂载到容器的/data目录
- -v /docker/redis/conf/redis.conf:/etc/redis/redis.conf:将主机的/docker/redis/conf/redis.conf配置文件挂载到容器的/etc/redis/redis.conf文件
- -d redis:后台程序运行redis
- redis-server /etc/redis/redis.conf:指定redis启动的配置文件
5、通过docker ps命令查看redis是否启动成功
6、进入容器并连接redis
docker exec -it redis redis-cli -a 123456
边栏推荐
- SRv6----IS-IS扩展
- Exploration of webots and ROS joint simulation (II): model import
- 什么是乐观锁,什么是悲观锁
- Euler function: find the number of numbers less than or equal to N and coprime with n
- Bezier curve learning
- 力扣399【除法求值】【并查集】
- Matlab drawing checkerboard (camera calibration)
- Analysis of Yolo series principle
- Tokenizer description in Bert
- Implementation code of interceptor and filter
猜你喜欢

Structure diagram of target detection network

Solution to the encoding problem encountered by the crawler when requesting get/post

XSS 跨站脚本攻击

20220623 Adobe Illustrator入门

pgsql_ UDF01_ jx

Install Anaconda + NVIDIA graphics card driver + pytorch under win10_ gpu

Bezier curve learning

Uniapp uses uparse to parse the content of the background rich text editor and modify the uparse style

Data warehouse (3) star model and dimension modeling of data warehouse modeling

Stanford doggo source code study
随机推荐
【微积分】拉格朗日乘子法
Install Anaconda + NVIDIA graphics card driver + pytorch under win10_ gpu
Leetcode: array fast and slow pointer method
How to realize wireless Ethernet high-speed communication for multiple Mitsubishi PLCs?
Recovering the system with Clonezilla USB disk
直播回顾 | smardaten李鸿飞解读中国低/无代码行业研究报告:风向变了
滑块验证 - 亲测 (京东)
Autoregressive model of Lantern Festival
Reverse crawling verification code identification login (OCR character recognition)
利用无线技术实现分散传感器信号远程集中控制
Degree of freedom analysis_ nanyangjx
Steps for ROS to introduce opencv (for cmakelist)
自动化测试中,三种常用的等待方式,强制式(sleep) 、 隐式 ( implicitly_wait ) 、显式(expected_conditions)
Selenium 搭建 Cookies池 绕过验证反爬登录
Segmentation of structured light images using segmentation network
How to use leetcode
Uniapp uses uparse to parse the content of the background rich text editor and modify the uparse style
Sqoop merge usage
dedecms小程序插件正式上线,一键安装无需任何php或sql基础
Speckle denoising method for ultrasonic image