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
阅读 2k
1 个回答

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题