docker-compose redis 设置密码
时间: 2023-08-19 21:12:22 浏览: 323
要在docker-compose中设置Redis密码,你可以在docker-compose.yml文件中的Redis服务部分添加一个environment子块,并在其中设置REDIS_PASSWORD变量。例如:
version: '3'
services:
redis:
image: redis
environment:
- REDIS_PASSWORD=yourpassword
这样,Redis容器将使用"yourpassword"作为密码进行身份验证。请确保将"yourpassword"替换为您想要设置的实际密码。
#### 引用[.reference_title]
- *1* *2* [docker-compose 中设置redis密码](https://blog.csdn.net/weixin_35754676/article/details/129077195)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [docker-compose设置redis密码](https://blog.csdn.net/weixin_35749786/article/details/128872793)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文