docker-compose.yml文件中配置redis 生成了redis.conf目录而不是文件?
docker-compose.yml文件中配置redis
#redis服务
redis:
image: redis:6.0.8
ports:
- "6379:6379"
volumes:
- /app/redis/redis.conf:/etc/redis/redis.conf
- /app/redis/data:/data
networks:
- blog_network
command: redis-server /etc/redis/redis.conf
在/app/redis下生成了redis.conf目录而不是redis.conf文件,要怎么修改才能生成文件呢?手动将redis.conf目录删除后改成文件后启动报错
Error response from daemon: failed to create
shim task: OCI runtime create
failed: runc create failed:
unable to start container process:
error during container init:
error mounting "/app/redis/redis.conf"
to rootfs at "/etc/redis/redis.conf":
mount /app/redis/redis.conf:/etc/redis/redis.conf (
via /proc/self/fd/6),
flags: 0x5000: not a directory:
unknown: Are you trying to mount a directory onto a file (or vice-versa)?
Check if the specified host path exists and is the expected type
回复
1个回答

test
2024-07-03
/app/redis/redis.conf:/etc/redis/redis.conf 这个是指定文件了,改成- /app/redis/conf/:/etc/redis/
指定目录就行了 把redis.conf放到conf目录下.
回复

适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容