一、简介
Docker容器部署Redis的教程,配置文件方式启动服务。
二、步骤
1、拉取redis镜像
docker pull redis
2、创建挂载目录
mkdir /docker-data/redis
3、下载redis.conf文件
wget http://download.redis.io/redis-stable/redis.conf
4、权限
chmod 777 redis.conf
5、修改默认配置信息
vi /docker-data/redis/redis.conf
bind 127.0.0.1 # 这行要注释掉,解除本地连接限制
protected-mode no # 默认yes,如果设置为yes,则只允许在本机的回环连接,其他机器无法连接。
daemonize no # 默认no 为不守护进程模式,docker部署不需要改为yes,docker run -d本身就是后台启动,不然会冲突
requirepass 123456 # 设置密码
appendonly yes # 持久化
6、docker启动redis
docker run --name redis \
-p 6379:6379 \
-v /docker-data/redis/redis.conf:/etc/redis/redis.conf \
-v /docker-data/redis:/data \
-d redis redis-server /etc/redis/redis.conf --appendonly yes
说明:
- -p 6379:6379:端口映射,前面是宿主机,后面是容器。
- –name redis:指定该容器名称。
- -v 挂载文件或目录:前面是宿主机,后面是容器。
- -d redis redis-server /etc/redis/redis.conf:表示后台启动redis,以配置文件启动redis,加载容器内的conf文件。
- appendonly yes:开启redis 持久化。
文章评论
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Appreciate it for all your efforts that you have put in this. very interesting info .
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Some times its a pain in the ass to read what blog owners wrote but this site is rattling user genial! .
Your article helped me a lot, is there any more related content? Thanks!
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your article helped me a lot, is there any more related content? Thanks!
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your article helped me a lot, is there any more related content? Thanks!
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your article helped me a lot, is there any more related content? Thanks!
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Your article helped me a lot, is there any more related content? Thanks!
Your article helped me a lot, is there any more related content? Thanks!
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.com/join?ref=P9L9FQKY
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Thank you, your article surprised me, there is such an excellent point of view. Thank you for sharing, I learned a lot.
Thank you, your article surprised me, there is such an excellent point of view. Thank you for sharing, I learned a lot.
Thank you, your article surprised me, there is such an excellent point of view. Thank you for sharing, I learned a lot. http://4149302.cryptostarthome.com
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Your article helped me a lot, is there any more related content? Thanks!