[英]Docker image build "Access is denied” error on Windows 10
I'm trying to build a node docker image for an application using Firebase and React on Windows 10, but it's giving me the following error:我正在尝试为使用 Firebase 和 React on Windows 10 的应用程序构建节点 docker 映像,但它给了我以下错误:
> docker build -t projectName .
[+] Building 15.5s (6/8)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/node:latest 11.0s
=> [auth] library/node:pull token for registry-1.docker.io 0.0s
=> ERROR [internal] load build context 4.3s
=> => transferring context: 102.71MB 4.3s
=> CACHED [1/3] FROM docker.io/library/node:latest@sha256:ca6daf1543242acb0ca59ff425509eab7defb9452f6ae07c156893db06c7a9a4 0.0s
------
> [internal] load build context:
------
error from sender: open functions\node_modules\google-gax\protos\google\iam\v1\logging: Access is denied.
Dockerfile: Dockerfile:
FROM node:latest
COPY . .
RUN npm install
CMD npm run start
I've tried different node versions, pulling the image and then building it again, but it doesn't seem to fix the error.我尝试了不同的节点版本,提取图像然后再次构建它,但它似乎无法修复错误。 This is the first time I'm using docker (other than the getting-started tutorial, which worked), so please let me know if there's anything I need to add?
这是我第一次使用 docker(除了入门教程,它有效),所以请告诉我是否需要添加任何内容? Any ideas?
有任何想法吗?
As theJeztah has pointed it out, the build-daemon can't access functions\\node_modules\\google-gax\\protos\\google\\iam\\v1\\logging
.正如theJeztah指出的那样,构建守护进程无法访问
functions\\node_modules\\google-gax\\protos\\google\\iam\\v1\\logging
。
This can also happen if your file paths are too long.如果您的文件路径太长,也会发生这种情况。 In my case I have solved it by moving the folder to a directory with a shorter path.
在我的情况下,我通过将文件夹移动到路径较短的目录来解决它。
This answer provides a powershell command to find long paths: Get-ChildItem -Path $dir -Recurse -Directory | % { $_.FullName } | Sort-Object { $_.Length } -Descending | Select -first 5
此答案提供了一个 powershell 命令来查找长路径:
Get-ChildItem -Path $dir -Recurse -Directory | % { $_.FullName } | Sort-Object { $_.Length } -Descending | Select -first 5
Get-ChildItem -Path $dir -Recurse -Directory | % { $_.FullName } | Sort-Object { $_.Length } -Descending | Select -first 5
I happened to have this error and I just updated the Docker to the latest version and resolved this issue.我碰巧遇到了这个错误,我刚刚将 Docker 更新到最新版本并解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.