在用docker-compose创建redis容器的时候,发现配置文件没用生效,进入容器后查看配置文件发现提示是一个文件夹
原来的docker-compose
version: '3.8'
services:
redis:
image: redis
container_name: redis
restart: always
ports:
- "6379:6379"
command: redis-server /data/redis/config/redis.conf
volumes:
- /home/z12589/douhuang/redis/config/redis.conf:/data/redis/config/redis.conf # 映射配置文件目录,宿主机:容器
- /home/z12589/douhuang/redis/data:/data/redis/data # 映射数据目录,宿主机:容器
# - /home/z12589/douhuang/redis/log/redis.log:/data/redis/log/redis.log
privileged: true #使用该参数,container内的root拥有真正的root权限
优化后的docker-compose文件
version: '3.8'
services:
redis:
image: redis
container_name: redis
restart: always
ports:
- "6379:6379"
command: redis-server /data/redis.conf
volumes:
- /home/z12589/douhuang/redis/config/redis.conf:/data/redis.conf # 映射配置文件目录,宿主机:容器
- /home/z12589/douhuang

最低0.47元/天 解锁文章
514

被折叠的 条评论
为什么被折叠?



