【发布时间】:2018-05-26 12:30:44
【问题描述】:
几个小时以来,我一直在为 docker compose 苦苦挣扎。我正在构建角度应用程序。我可以看到 dist 目录中的文件。现在我想与 nginx 容器共享这些文件。我认为共享卷会做到这一点。但是当我添加
services:
client:
volumes:
- static:/app/client/dist
nginx:
volumes:
- static:share/user/nginx/html
volumes:
static:
试试docker-compose up --build
我收到了这个错误
client_1 | EBUSY: resource busy or locked, rmdir '/app/client/dist'
client_1 | Error: EBUSY: resource busy or locked, rmdir '/app/client/dist'
client_1 | at Object.fs.rmdirSync (fs.js:863:18)
client_1 | at rmdirSync (/app/client/node_modules/fs-extra/lib/remove/rimraf.js:276:13)
client_1 | at Object.rimrafSync [as removeSync] (/app/client/node_modules/fs-extra/lib/remove/rimraf.js:252:7)
client_1 | at Class.run (/app/client/node_modules/@angular/cli/tasks/build.js:29:16)
client_1 | at Class.run (/app/client/node_modules/@angular/cli/commands/build.js:250:40)
client_1 | at resolve (/app/client/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
client_1 | at new Promise (<anonymous>)
client_1 | at Class.validateAndRun (/app/client/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
client_1 | at Promise.resolve.then.then (/app/client/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)
client_1 | at <anonymous>
client_1 | npm ERR! code ELIFECYCLE
client_1 | npm ERR! errno 1
client_1 | npm ERR! app@0.0.0 build: `ng build --prod`
client_1 | npm ERR! Exit status 1
client_1 | npm ERR!
client_1 | npm ERR! Failed at the app@0.0.0 build-prod script.
client_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
非常感谢任何帮助
【问题讨论】:
-
听起来像是权限问题。
-
是的,我想是的
-
你解决过这个问题吗? @AbdelrhmanHussien 我有同样的问题。每当您将卷附加到节点生成的目录时,就会出现此问题
-
我已经解决了这个问题,是的,在我这边,目录是在此过程中生成的,所以当我尝试将卷附加到它时。它还不存在。因此,我查看了角度配置以使该目录永久化并为我解决了这个问题。希望对您有所帮助
-
@AbdelrhmanHussien,您是否碰巧在 angular.json 中将
deleteOutputPath设置为false来做到这一点?
标签: docker docker-compose docker-volume