简体   繁体   中英

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:

> 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:

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? Any ideas?

As theJeztah has pointed it out, the build-daemon can't access 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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM