docker使用redis.conf部署redis
时间: 2023-08-26 13:15:07 浏览: 138
您可以使用以下步骤来使用redis.conf文件部署Redis:
1. 首先,创建一个Redis容器并挂载redis.conf文件:
```
docker run --name redis \
-p 40002:6379 \
-v /usr/local/redis/conf:/data \
-v /usr/local/redis/conf:/usr/local/etc/redis \
-d redis:6.2.7 \
redis-server /usr/local/etc/redis/redis.conf
```
2. 然后,更新容器的重启策略,以便容器在启动时自动重启:
```
docker update --restart=always redis
```
这样就可以使用redis.conf文件来部署Redis容器了。请注意,将redis.conf文件放在/usr/local/redis/conf目录下,并将该目录挂载到容器的/data和/usr/local/etc/redis目录中。另外,通过指定容器的名称和端口映射,可以访问Redis服务。在上述示例中,Redis将通过主机的40002端口进行访问。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *2* [docker中redis.conf挂载配置文件无效](https://blog.csdn.net/L_1010_J/article/details/120941143)[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^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [Redis docker安装及redis.conf配置文件解析](https://blog.csdn.net/m0_70651612/article/details/124901394)[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^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文