我试图为我正在从事的项目(项目人行道)从码头图像创建一个容器。容器正确地旋转,除了最后一步它给出了这个错误:
Creating projectsidewalk-db ... error
ERROR: for projectsidewalk-db Cannot create container for service db: invalid volume specification: 'C:\Users\johns\OneDrive\documents\GitHub\sidewalkwebpage\db\init.sh:/docker-entrypoint-initdb.d/init.sh:rw':
invalid mount config for type "bind": source path must be a directory
ERROR: for db Cannot create container for service db: invalid volume specification: 'C:\Users\johns\OneDrive\documents\GitHub\sidewalkwebpage\db\init.sh:/docker-entrypoint initdb.d/init.sh:rw':
invalid mount config for type "bind": source path must be a directory
ERROR: Encountered errors while bringing up the project.
make: *** [docker-up-db] Error 1我查看了其他堆栈溢出线程,并尝试了修复,我创建了一个新变量COMPOSE_CONVERT_WINDOWS_PATHS并将其设置为等于一个,但它没有工作。我想知道是否有人知道如何解决这个问题。
发布于 2020-01-05 08:07:02
您不能在Windows上挂载文件,只允许目录。在moby中存在一个问题,这个问题没有得到解决,因为这实际上是Windows的一个限制,而不是Docker:https://github.com/moby/moby/issues/30555#issuecomment-279170073。
结束语:我想你的docker-compose.yml里有这样的东西
volumes:
- .\db\init.sh:/docker-entrypoint-initdb.d/init.sh:rw相反,应该是这样:
volumes:
- .\db:/docker-entrypoint-initdb.d/:rwhttps://stackoverflow.com/questions/59597711
复制相似问题