我正在使用Windows 7企业版
Docker Client version:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 17:00:50 2016
OS/Arch: windows/amd64
Docker Server version:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 23:26:11 2016
OS/Arch: linux/amd64
docker-compose version:
docker-compose version 1.9.0, build 2585387
docker-py version: 1.10.6
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2h 3 May 2016
在Windows上使用docker工具箱时,我无法弄清楚如何在docker-compose.yml文件中安装卷。
以下是docker-compose.yml
文件。
version: '2'
services:
myapp:
build:
context: .
args:
ADMIN_PASS= welcome1
ports:
- "7001:8001"
volumes:
- "/C/myapp/gradleBuild/myappEar/libs:/myappEar"
当我在下面运行docker-compose up
时,我得到的错误
ERROR: for myapp Cannot create container for service myapp: create \C\myapp\gradleBuild\myappEar\libs: "\\C\\myapp\\gradleBuild\\myappEar\\libs" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed
←[31mERROR←[0m: Encountered errors while bringing up the project.
当我将卷部分更改为
时volumes:
- "/c/myapp/gradleBuild/myappEar/libs:/myappEar"
它会抛出相同的错误
当我最终将音量部分更改为
时volumes:
- "C:/myapp/gradleBuild/myappEar/libs:/myappEar"
抛出以下错误
ERROR: for myapp Cannot create container for service myapp: Invalid bind mount spec "C:\\myapp\\gradleBuild\\myappEar\\libs:/myappEar:rw": Invalid volume specification: 'C:/myapp/gradleBuild/myappEar/libs:/myappEar:rw'
←[31mERROR←[0m: Encountered errors while bringing up the project.
任何人都可以帮我解决这个问题吗?
提前致谢。
答案 0 :(得分:3)
请注意,如果您使用docker toolbox(通过VirtualBox VM表示docker),则默认情况下只有/c/users/mylogin
可用。
如果您的路径不包含c:\Users\myLogin
,则需要declare other mount locations。
您只能通过Windows 10上的HyperV VM访问更多的C驱动器(由于您使用的是Windows 7,因此您没有)。