-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
failed to solve: archive/tar: unknown file mode ?rwxr-xr-x while following official tutorial #14083
Comments
I also get the same error. I'm doing the same tutorial |
=> CACHED [ 1/10] FROM docker.io/library/ubuntu:jammy 0.0s
|
got the same problem, Docker Desktop 4.30.0 (149282) is currently the newest version available. |
is there a workaround yet? |
I also got the same problem with Window Local machine. |
Same error here. |
was able to build with |
Having same issue. I was trying to fix another issue from Node about missing a missing dependency (rollup/rollup-linux-x64-gnu), thought it may have been something to do with creating the project on a Windows host and trying to run it in a Linux container, so I tried recreating the vite project in a node container - and then ran into this instead! I tried to clear my docker cache ( I'm running Windows 10 22H2 and latest Docker 4.30.0. What I did was:
Result:
Dockerfile:
Section of docker-compose.yml (note: I am not using watch):
The front end folder structure:
|
From what I can tell, it looks like something is corrupting the attributes of files accessed via bind mounts when the node_modules is being generated inside a Linux image but being built on Windows. If you recreate the node_modules folder outside of docker, in Windows directly, using npm install, you should be able to build the image. Alternately, if you copy the code without the node_modules folder into your image from your Dockerfile and run an npm install as a step in the build from the code directory, that should work. |
Issue occurs with python even where the venv was already generated in the Dockerfile. Could any mount be corrupting? |
Update: I think I found a workaround. First, use 7Zip to compress the folder that's causing you issues (default settings for a .7z archive), then delete the original folder (if you can), afterwards extract the archive, finally try rebuilding container (in my case run You likely don't need 7Zip to compress (a generic utility which doesn't preserve the original mode will likely work), but rather some way to remove the archive mode. How I found outI wanted to check if there was a corrupted file and I found that the affected folder is in archive mode using PowerShell's First step (summary: found nothing unusual): I ran Second step (summary: affected folder is in archive mode for some reason): Open up powershell, run Third step (summary: Attempted to unsuccessfully remove archive mode by using the affected folder's properties window): I opened the folder properties, went into 'advanced' under attributes (on bottom of 'general' tab), enabled 'Compress contents to save diskspace', set to all subfolders, pressed apply. Got an error that some random file '.acorn-jx0qi98P' cannot be accessed by the system. Pressed 'Cancel', went back to the folder, unset the compression checkbox, applied to all subfolders. Pressed apply. Went back and unticked 'Read Only' (which was a box - so it only applied to some folders), and applied to subfolders. Apply again, then pressed 'ok. Tried Foruth step (summary: Confirmed vite actually worked on Windows): Ran Fifth step (summary: attempted to remove archive mode by zipping (7z), deleting broken folder, extracting zipped copy): As I couldn't figure out the PowerShell command to modify the file attributes, I zipped the folder using 7zip, extracted it again (and had to rename the extracted folder because Windows was upset that the folder was open somewhere when I tried to delete the previous one), updated the Dockerfile and Note that the affected folder's contents were mostly created in a Docker container using mount. |
# syntax=docker/dockerfile:1
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
EXPOSE 3000 Trying to repro on Windows with DD 4.30.0 (149282) using Powershell or Git bash and so far was not able to: getting-started-app> dir
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 27/05/2024 16:10 spec
d----- 27/05/2024 16:10 src
-a---- 27/05/2024 16:14 151 Dockerfile
-a---- 29/05/2024 11:30 648 package.json
-a---- 27/05/2024 16:10 269 README.md
-a---- 27/05/2024 16:10 147266 yarn.lock getting-started-app> docker buildx inspect
Name: default
Driver: docker
Last Activity: 2024-05-29 09:30:01 +0000 UTC
Nodes:
Name: default
Endpoint: default
Status: running
BuildKit version: v0.13.2
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
Labels:
org.mobyproject.buildkit.worker.moby.host-gateway-ip: 192.168.65.254
GC Policy rule#0:
All: false
Filters: type==source.local,type==exec.cachemount,type==source.git.checkout
Keep Duration: 48h0m0s
Keep Bytes: 13.82GiB
GC Policy rule#1:
All: false
Keep Duration: 1440h0m0s
Keep Bytes: 100GiB
GC Policy rule#2:
All: false
Keep Bytes: 100GiB
GC Policy rule#3:
All: true
Keep Bytes: 100GiB getting-started-app> docker build -t getting-started .
[+] Building 8.3s (11/11) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 190B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 0.5s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696f 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/4] FROM docker.io/library/node:18-alpine 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 10.61kB 0.2s
=> CACHED [2/4] WORKDIR /app 0.0s
=> [3/4] COPY . . 0.1s
=> [4/4] RUN yarn install --production 6.5s
=> exporting to image 0.7s
=> => exporting layers 0.7s
=> => writing image sha256:baa0e92a16a65cf7368be710438312ff458cbb11aab6887f761e287897bb9a07 0.0s
=> => naming to docker.io/library/getting-started 0.0s
View build details: docker-desktop://dashboard/build/default/default/c5jgp679mkdtmvvsyz32mukhb getting-started-app> docker run -dp 127.0.0.1:3000:3000 -w /app --mount "type=bind,src=$pwd,target=/app" node:18-alpine sh -c "yarn install && yarn run dev"
6ad7a5bc91370bee6fbaf88ec42dc2cee97d89952288cb0ada54a5c295248866 getting-started-app> docker logs 6ad7a5bc91370bee6fbaf88ec42dc2cee97d89952288cb0ada54a5c295248866
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies... getting-started-app> docker stop 6ad7a5bc91370bee6fbaf88ec42dc2cee97d89952288cb0ada54a5c295248866
6ad7a5bc91370bee6fbaf88ec42dc2cee97d89952288cb0ada54a5c295248866 getting-started-app> docker build -t getting-started .
[+] Building 10.0s (12/12) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 190B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 0.9s
=> [auth] docker/dockerfile:pull token for registry-1.docker.io 0.0s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696f 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/4] FROM docker.io/library/node:18-alpine 0.0s
=> [internal] load build context 1.2s
=> => transferring context: 53.39MB 1.2s
=> CACHED [2/4] WORKDIR /app 0.0s
=> [3/4] COPY . . 0.7s
=> [4/4] RUN yarn install --production 6.1s
=> exporting to image 0.6s
=> => exporting layers 0.6s
=> => writing image sha256:3855c0ea1503635711c31ed321501740036aff2117b5aa97107f1ff454199532 0.0s
=> => naming to docker.io/library/getting-started 0.0s
View build details: docker-desktop://dashboard/build/default/default/ljw2dxdx6piu57l3ofzrwwg6g @ra2dd Do you have containerd store enabled in any case?: Can you also show the output of |
Hi I exactly did what you did and get the same error:
I don't have containerd enabled: docker buildx inspect
|
same issue windows server 2022 docker 4.30.0 |
I had the same problem. I was working with a Laravel app, and noticed a symbolic link to another folder inside the same project. I removed that folder, tried again and worked. |
None of obviuos steps worked for me, even settings all line endings to LF, |
@ainze Ok looking at Can you run the following commands?: getting-started-app> rm -r -fo node_modules
getting-started-app> yarn install
getting-started-app> docker build -t getting-started .
[+] Building 11.9s (12/12) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 190B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 1.0s
=> [auth] docker/dockerfile:pull token for registry-1.docker.io 0.0s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696fbfdf2d83dda33e 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/4] FROM docker.io/library/node:18-alpine 0.0s
=> [internal] load build context 1.4s
=> => transferring context: 59.61MB 1.4s
=> CACHED [2/4] WORKDIR /app 0.0s
=> [3/4] COPY . . 1.0s
=> [4/4] RUN yarn install --production 7.5s
=> exporting to image 0.6s
=> => exporting layers 0.6s
=> => writing image sha256:01dfd9f1185ae4e61b6d136a33d6804dda82437cfd7f8a4887144aed018456f5 0.0s
=> => naming to docker.io/library/getting-started 0.0s
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/30a2t3aqdv920l5sq2l1ar7co If it still doesn't work can you attach the getting-started-app> Get-ChildItem -Recurse |
Select-Object FullName, Mode, Attributes, LastWriteTime, Length |
Format-Table -AutoSize |
Out-File -FilePath ".\FileAttributes.txt" Might help figuring out what file is causing this issue. |
@crazy-max I don't have yarn installed BUT
That works ... I tried doing the same thing kinda with a PHP project and composer.
Then i removed the /vendor folder (it's like node_modules)
Definately progress. However when I then do composer install: Again:
In the FileAttributes there are many archives:
Is that the issue? |
I had the same problem, It is solved when I use WSL in current directory to run docker build |
I added a .dockerignore file to the root directory of the project with the following contents:
the image is build and launched with a mount type bind |
I have been fighting with this error the past few days as well. I just fixed it by deleting the folder where my project was and re-cloning the repo that was causing me trouble, though the error moved to another cloned repo that I was using besides the one that threw the original error. Did the same with this second project, ran docker compose up and everything worked fine. |
Tried everything in a python project, had to delete it and clone again for it to work. |
I just started getting this error. In my case, it was caused by moving a CSS file into Before:
After:
In the 'After' case, I added
Reverting the changes solved the issue. |
I faced the same error. Deleted the repo and cloned again - worked great. |
I solve this (doing all you tried before and didnt work for me) closing visual studio code, going to folder in windows explorer, opening a Git Bash terminal and launching docker built -t image_name . Hope this could be helpful |
It does seem to have this problem after editing a couple of files with wsl.. I do need to figure out how to repair it. |
agreed, breaking when editing a file in WSL is suboptimal |
like @ashokkhetan, just delete it & git clone again. Worked fine on my side! |
This worked for me |
Thank you! |
I'm also hitting this error now. Same as everyone else, I'm on a Windows 11 machine with wsl and am trying to use a vscode dev container. It was fine until I updated to Docker v4.32.0 and now my devcontainers don't build. Edit: I downgraded to Docker 4.29, deleted the entire repo folder, re-cloned the repo, and things seem to work again. |
Same here, In my case I have a PHP container for a Laravel app, I ran |
worked for me |
thank you, I added
|
Hey! I tried to build the image from the WSL shell, and it returned the file that was having permission issues. I added the file to my .dockerignore file, and then it built normally. |
Same exact issue. As one of the commenters said, most of the set up was done in WSL, including |
I think if you simply delete node_modules or add them in dockerignore file will do the trick. |
i would suggest following this tutorial i have found doenst quite solve the problem mentioned but as i ran into a similar issue (while creating a new nextjs project) this quite helped me |
Thanks it also worked for me on windows 11 |
In my case, the problem was solved simply by creating a .dockerignore file with the same content as .gitignore. It worked well! |
I was running into this issue in Dagger dagger/dagger/issues/8545 referenced it in Dagger, in my case there were symbolic link files in the directory, removed those files and it proceeded correctly. This is going to be very difficult for docker / dagger to fix as it's an issue with/feature of the go archive/tar package itself, I don't even see somewhere to report an issue with that: |
To do this, should I install Docker inside WSL? |
Its work for me when I run this command in wsl |
Delete de .docker folder and them build your container again. |
Ignoring the |
I was having this same issue for a Ruby on Rails dev-container that I was building, where all of sudden I started to get the same error you mentioned: "ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x". After reading the following I just created a ".dockerignore" file and added: "/node_modules/*" to it; reopened my dev-container and everything worked again! .dockerignore |
Either it is your volumes or node modules , in my case it was my sql volume which was issue . Just add them to .dockerignore |
I encountered a similar issue and was able to resolve it. If any files from your project are stored on OneDrive, try moving them to your local disk. That should fix the problem. I suspect it may be related to some unusual behavior in Windows that encrypts or modifies files. |
Description
I get this console output while trying to create image using docker following official documentation:
Dockerfile:
Reproduce
Expected behavior
Should build an image.
docker version
Client: Cloud integration: v1.0.35+desktop.13 Version: 26.1.1 API version: 1.45 Go version: go1.21.9 Git commit: 4cf5afa Built: Tue Apr 30 11:48:43 2024 OS/Arch: windows/amd64 Context: default Server: Docker Desktop 4.30.0 (149282) Engine: Version: 26.1.1 API version: 1.45 (minimum version 1.24) Go version: go1.21.9 Git commit: ac2de55 Built: Tue Apr 30 11:48:28 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.31 GitCommit: e377cd56a71523140ca6ae87e30244719194a521 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Diagnostics ID
B4CDA7F3-D311-4B04-9568-259F15E34172/20240521101959
Additional Info
After deleting all containers and images associated with folder the error persist.
Link to the tutorial that I'm running commands from
The text was updated successfully, but these errors were encountered: