尝试设置 docker,以便当我在我的 windows 机器上更改我的项目文件时,它们会在我的 docker 容器中更新。从这个问题中,我了解到您应该使用 docker-compose.yml 文件中的卷设置。
但我仍然无法让它工作。
我试图将音量设置为(+30 个类似组合):
volumes:
- x
.:/home/app/angular-seed
//c/Users/k/dev/angular-seed/:/home/app/angular-seed
c/Users/k/dev/angular-seed:/home/app/angular-seed
C:/User/k/dev/angular-seed
我也尝试过添加一个 .env 文件:
COMPOSE_CONVERT_WINDOWS_PATHS=1
COMPOSE_CONVERT_WINDOWS_PATHS=0
当我做docker-compose up
并将卷设置为.:/home/app/angular-seed
我得到:
ERROR: for angular-seed Cannot create container for service angular-seed: invalid bind mount spec "C:\\Users\\k\\dev\\angular-seed:/home/app/angular-seed:rw": invalid volume specification: 'C:\Users\k\dev\angular-seed:/home/app/angular-seed:rw' [31mERROR[0m: Encountered errors while bringing up the project.
当我将音量设置为时,/c/Users/dev/angular-seed:/home/app/angular-seed
我得到:...includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intented to pass a host directory, use absolute path.
当我把它设置为C:/User/k/dev/angular-seed
我得到...invalid volume specification...
我检查了 Oracle VM Virtual Box Manager 的共享文件夹(机器文件夹)是否设置为:
c/Users \\?\c:\Users (auto mount) yes (Access) full
我看到的其他回复来自:
Recreating angular-seed-start
Attaching to angular-seed-start
[36mangular-seed-start |[0m npm info it worked if it ends with ok
[36mangular-seed-start |[0m npm info using npm@3.10.3
[36mangular-seed-start |[0m npm info using node@v6.6.0
[36mangular-seed-start |[0m npm info lifecycle angular-seed@0.0.0~prestart: angular-seed@0.0.0
[36mangular-seed-start |[0m npm info lifecycle angular-seed@0.0.0~start: angular-seed@0.0.0
[36mangular-seed-start |[0m
[36mangular-seed-start |[0m > angular-seed@0.0.0 start /home/app/angular-seed
[36mangular-seed-start |[0m > gulp serve.dev --color
[36mangular-seed-start |[0m
[36mangular-seed-start |[0m sh: 1: gulp: not found
[36mangular-seed-start |[0m
[36mangular-seed-start |[0m npm info lifecycle angular-seed@0.0.0~start: Failed to exec start script
[36mangular-seed-start |[0m npm ERR! Linux 4.4.43-boot2docker
[36mangular-seed-start |[0m npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
至
[31mERROR[0m: Named volume "c/Users/k/dev/angular-seed:/home/app/angular- seed:rw" is used in service "angular-seed" but no declaration was found in the volumes section.
至
Recreating 90b0444c8ee3_90b0444c8ee3_90b0444c8ee3_90b0444c8ee3_angular-seed-start
ERROR: for angular-seed Cannot create container for service angular-seed: invalid bind mount spec "C:\\Users\\k\\dev\\angular-seed\\dev\\angular-seed:/home/app/angular-seed:rw": invalid volume specification: 'C:\Users\k\dev\angular-seed\dev\angular-seed:/home/app/angular-seed:rw'
[31mERROR[0m: Encountered errors while bringing up the project.
至
Recreating 90b0444c8ee3_90b0444c8ee3_90b0444c8ee3_angular-seed-start
ERROR: for angular-seed Cannot create container for service angular-seed: create \c\Users\k\dev\angular-seed: "\\c\\Users\\k\\dev\\angular-seed" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intented to pass a host directory, use absolute path
[31mERROR[0m: Encountered errors while bringing up the project.