failed to solve: archive/tar: unknown file mode ?rwxr-xr-x while following official tutorial
Description
I get this console output while trying to create image using docker following official documentation:
[+] Building 16.4s (8/11) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 188B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 2.1s
=> [auth] docker/dockerfile:pull token for registry-1.docker.io 0.0s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:a57df69d0ea827fb7266491f2813635d 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
=> ERROR [internal] load build context 14.0s
=> => transferring context: 52.90MB 14.0s
------
> [internal] load build context:
------
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
Dockerfile:
# syntax=docker/dockerfile:1
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
EXPOSE 3000
Reproduce
- git clone https://github.com/docker/getting-started-app.git
- docker build -t getting-started .
- 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"
- Stop the container
- docker build -t getting-started .
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
Client:
Version: 26.1.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.27.0-desktop.2
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.29
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.23
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.1.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.8.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 2
Server Version: 26.1.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.146.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 7.444GiB
Name: docker-desktop
ID: 2fd69fc4-4772-448e-afdb-2e608219d290
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=npipe://\\.\pipe\docker_cli
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
Diagnostics ID
B4CDA7F3-D311-4B04-9568-259F15E34172/20240521101959
Additional Info
After deleting all containers and images associated with folder the error persist.
I also get the same error. I'm doing the same tutorial
=> CACHED [ 1/10] FROM docker.io/library/ubuntu:jammy 0.0s => ERROR [internal] load build context 6.0s => => transferring context: 288.17MB 6.0s => CANCELED [ 2/10] RUN apt-get update -y 6.3s
[internal] load build context:
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
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.
I tried with Powershell and git bash got the same error
#6 ERROR: archive/tar: unknown file mode ?rwxr-xr-x
then I tried with WSL (Window subsystem linux) so now it is working.
Same error here.
was able to build with docker compose -f .devcontainer/docker-compose.yml up -d --build but still busted from a devcontainer perspective
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 (docker system prune -a) and restart the Docker Engine via desktop but it didn't work.
I'm running Windows 10 22H2 and latest Docker 4.30.0.
What I did was:
- Created a dev container from a folder using VS Code's Dev Environments. The container was node:18 with no additions offered by VS Code.
- Installed vite using npm
- Created a vite project for React and Typescript
- Ran advised commands after creating a vite project.
- Stopped the container.
- Cleared the contents of the original folder.
- Copied the contents of the directory created by vite.
- Ran
docker compose up.
Result:
...
=> CACHED [app-frontend 2/6] WORKDIR /notes-app-frontend
------
> [app-frontend internal] load build context:
------
failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
Dockerfile:
FROM node:20-alpine
WORKDIR /notes-app-frontend
COPY package.json .
COPY package-lock.json .
RUN npm install
COPY . .
CMD ["npm", "run", "dev"]
Section of docker-compose.yml (note: I am not using watch):
...
app-frontend:
depends_on:
- app-backend
container_name: notes-app-frontend
build: ./notes-app-frontend
restart: on-failure
env_file: ./.env
environment:
- APP_FRONT_DOCKER_PORT=$APP_FRONT_DOCKER_PORT
ports:
- $APP_FRONT_LOCAL_PORT:$APP_FRONT_DOCKER_PORT
volumes:
- ./notes-app-frontend:/notes-app-frontend
develop:
watch:
- action: sync
path: ./notes-app-frontend
target: /src/
- action: rebuild
path: ./notes-app-frontend/package.json
- action: rebuild
path: .env
..
The front end folder structure:
full-stack-notes-docker
- docker-compose.yml
- ...
- - notes-app-frontend
- - - node_modules
- - - - ...
- - - public
- - - - ...
- - - src
- - - - ...
- - .env.sample
- - eslintrct.cjs
- - .gitignore
- - Dockerfile
- - index.html
- - package-lock.json
- - package.json
- - README.md
- - tsconfig.json
- - tsconfig.node.json
- - vite.config.ts
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.
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 docker compose up).
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 out
I wanted to check if there was a corrupted file and I found that the affected folder is in archive mode using PowerShell's ls command (displaying mode da---- for the notes-app-frontend folder).
First step (summary: found nothing unusual): I ran ls -lR in the command window opened by context menu option 'Open Linux shell here' in the affected folder, scanned through the output and found no corrupted permissions matching ?rwxr-xr-x or even with a question mark.
Second step (summary: affected folder is in archive mode for some reason): Open up powershell, run ls in the parent directory, notice that the affected folder (notes-app-frontend)'s mode is listed as da----. a means its an archive apparently.
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 docker compose up again. same issue.
Foruth step (summary: Confirmed vite actually worked on Windows): Ran npm run dev, got told some packages were missing, ran npm install, then ran npm run dev again and it worked on my host machine.
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 docker-compose.yml to reflect new folder name, ran docker compose up and it worked!
Note that the affected folder's contents were mostly created in a Docker container using mount.
git clone https://github.com/docker/getting-started-app.gitdocker build -t getting-started .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"- Stop the container
docker build -t getting-started .
# 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 docker buildx inspect?
git clone https://github.com/docker/getting-started-app.gitdocker build -t getting-started .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"- Stop the container
docker build -t getting-started .# syntax=docker/dockerfile:1 FROM node:18-alpine WORKDIR /app COPY . . RUN yarn install --production CMD ["node", "src/index.js"] EXPOSE 3000Trying 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.lockgetting-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: 100GiBgetting-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/c5jgp679mkdtmvvsyz32mukhbgetting-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" 6ad7a5bc91370bee6fbaf88ec42dc2cee97d89952288cb0ada54a5c295248866getting-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 6ad7a5bc91370bee6fbaf88ec42dc2cee97d89952288cb0ada54a5c295248866getting-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
docker buildx inspect?
Hi I exactly did what you did and get the same error:
PS C:\workbench\getting-started-app> docker build -t getting-started .
2024/05/30 17:59:11 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
[+] Building 0.0s (0/0) docker:default
2024/05/30 17:59:12 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 1.6s (7/10) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 188B 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
=> ERROR [internal] load build context 0.9s
=> => transferring context: 53.33MB 0.9s
------
> [internal] load build context:
------
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
View build details: docker-desktop://dashboard/build/default/default/ty18kym6bgy70kybfas2yq631
I don't have containerd enabled:
docker buildx inspect
PS C:\workbench\getting-started-app> docker buildx inspect
Name: default
Driver: docker
Last Activity: 2024-05-30 15:59:11 +0000 UTC
Nodes:
Name: default
Endpoint: default
Status: running
BuildKit version: v0.13.2
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, 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: 2.764GiB
GC Policy rule#1:
All: false
Keep Duration: 1440h0m0s
Keep Bytes: 20GiB
GC Policy rule#2:
All: false
Keep Bytes: 20GiB
GC Policy rule#3:
All: true
Keep Bytes: 20GiB
Running latest DD
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, but it worked when I ran docker compose build some-image-name using Git Bash. The one you get here https://git-scm.com/download/win Please consider that, I hope that helps anybody :)
@ainze Ok looking at => => transferring context: 53.33MB in your logs it seems to upload node_modules folder that has been previously created. Seems there is a file in it that has specific attributes but I'm still not sure why I don't repro on my side.
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 FileAttributes.txt file from this command:
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
PS C:\workbench\getting-started-app> docker build -t getting-started .
[+] Building 0.0s (0/0) docker:default
2024/05/31 22:07:21 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 2.4s (7/10) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 188B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 1.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
=> ERROR [internal] load build context 1.2s
=> => transferring context: 54.86MB 1.1s
------
> [internal] load build context:
------
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
View build details: docker-desktop://dashboard/build/default/default/dsbs73ikng1v7vqwao3ll8btm
PS C:\workbench\getting-started-app> rm -r -fo node_modules
PS C:\workbench\getting-started-app> yarn install
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 7.81s.
PS C:\workbench\getting-started-app> docker build -t getting-started .
2024/05/31 22:21:08 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
[+] Building 0.0s (0/0) docker:default
2024/05/31 22:21:08 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 9.9s (11/11) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 188B 0.0s
=> resolve image config for docker-image://docker.io/docker/dockerfile:1 1.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.1s
=> => transferring context: 59.62MB 1.1s
=> CACHED [2/4] WORKDIR /app 0.0s
=> [3/4] COPY . . 0.5s
=> [4/4] RUN yarn install --production 6.6s
=> exporting to image 0.5s
=> => exporting layers 0.5s
=> => writing image sha256:73a47f1faea1a357e3f7db8fa608fcb62c9d5f887bb3104ec4e90683f7790d2e 0.0s
=> => naming to docker.io/library/getting-started 0.0s
View build details: docker-desktop://dashboard/build/default/default/imqtsno6dc9ed0ux52e03ubo0
What's Next?
View a summary of image vulnerabilities and recommendations → docker scout quickview
That works ...
I tried doing the same thing kinda with a PHP project and composer.
PS C:\workbench\usolan> docker build .
[+] Building 0.0s (0/0) docker:default
2024/05/31 22:24:19 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 1.8s (5/6) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 286B 0.0s
=> [internal] load metadata for docker.io/library/php:8.3-apache 0.5s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 123B 0.0s
=> [1/2] FROM docker.io/library/php:8.3-apache@sha256:05da720a7fae00e19374f888dc386763493c6528e3a152379f93c4e5b2 0.0s
=> ERROR [internal] load build context 1.1s
=> => transferring context: 65.84MB 1.1s
------
> [internal] load build context:
------
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
View build details: docker-desktop://dashboard/build/default/default/8tyby6k4utn4kaozim8uzdg5d
PS C:\workbench\usolan>
Then i removed the /vendor folder (it's like node_modules)
PS C:\workbench\usolan> docker build .
[+] Building 0.0s (0/0) docker:default
2024/05/31 22:24:19 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 1.8s (5/6) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 286B 0.0s
=> [internal] load metadata for docker.io/library/php:8.3-apache 0.5s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 123B 0.0s
=> [1/2] FROM docker.io/library/php:8.3-apache@sha256:05da720a7fae00e19374f888dc386763493c6528e3a152379f93c4e5b2 0.0s
=> ERROR [internal] load build context 1.1s
=> => transferring context: 65.84MB 1.1s
------
> [internal] load build context:
------
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
View build details: docker-desktop://dashboard/build/default/default/8tyby6k4utn4kaozim8uzdg5d
PS C:\workbench\usolan>
Definately progress. However when I then do composer install:
Again:
PS C:\workbench\usolan> docker build .
[+] Building 0.0s (0/0) docker:default
2024/05/31 22:24:19 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 1.8s (5/6) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 286B 0.0s
=> [internal] load metadata for docker.io/library/php:8.3-apache 0.5s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 123B 0.0s
=> [1/2] FROM docker.io/library/php:8.3-apache@sha256:05da720a7fae00e19374f888dc386763493c6528e3a152379f93c4e5b2 0.0s
=> ERROR [internal] load build context 1.1s
=> => transferring context: 65.84MB 1.1s
------
> [internal] load build context:
------
ERROR: failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
View build details: docker-desktop://dashboard/build/default/default/8tyby6k4utn4kaozim8uzdg5d
PS C:\workbench\usolan>
In the FileAttributes there are many archives:
FullName : C:\workbench\usolan\vendor\brick\math\composer.json
Mode : -a----
Attributes : Archive, NotContentIndexed
LastWriteTime : 11/08/2022 00:54:19
Length : 744
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:
node_modules
Dockerfile
.dockerignore
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.
In my case, the fix was really easy: I had to add the folder name of my python virtual environment folder to my .dockerignore file. The problem was that Docker was trying to include those in the build.
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 ./styles and trying to import it directly.
Before:
PS C:\react\src> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
da---l 6/12/2024 9:23 AM collections
da---l 6/7/2024 9:43 PM components
da---l 6/5/2024 3:02 PM data
d----l 6/5/2024 12:30 PM pages
da---l 6/12/2024 9:15 AM plugins
da---l 6/12/2024 9:09 AM replication
-a---l 6/5/2024 11:28 AM 374 App.css
-a---l 6/12/2024 9:32 AM 1388 App.jsx
-a---l 6/12/2024 9:32 AM 829 database.js
-a---l 6/5/2024 11:25 AM 428 index.jsx
-a---l 6/5/2024 11:24 AM 232 theme.js
After:
PS C:\react\src> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
da---l 6/12/2024 9:23 AM collections
da---l 6/7/2024 9:43 PM components
da---l 6/5/2024 3:02 PM data
d----l 6/5/2024 12:30 PM pages
da---l 6/12/2024 9:15 AM plugins
da---l 6/12/2024 9:09 AM replication
d----- 6/12/2024 9:40 AM styles
-a---l 6/12/2024 9:42 AM 1416 App.jsx
-a---l 6/12/2024 9:32 AM 829 database.js
-a---l 6/12/2024 9:41 AM 435 index.jsx
In the 'After' case, I added import './styles/App.css'; to my App.jsx file. When attempting to build, I got the error:
PS C:/react> docker-compose up --build
[+] Building 0.0s (0/0) docker:default
2024/06/12 09:42:28 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 0.7s (5/9) docker:default
=> [react-app internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 441B 0.0s
=> [react-app internal] load metadata for docker.io/library/node:14 0.5s
=> [react-app internal] load .dockerignore 0.0s
=> => transferring context: 57B 0.0s
=> [react-app 1/5] FROM docker.io/library/node:14@sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f 0.0s
=> ERROR [react-app internal] load build context 0.0s
=> => transferring context: 24.11kB 0.0s
------
> [react-app internal] load build context:
------
failed to solve: archive/tar: unknown file mode ?rwxr-xr-x
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 . If you can, copy the folder to another place, copy it again to original folder and launch git bash terminal there. Doing this, ensure the same user who copy the folder and who is launching git bash terminal is the same therefore, permissions are granted over the folder and docker takes that permissions inherited from process chain.
Hope this could be helpful
I had the same problem, It is solved when I use WSL in current directory to run docker build
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.
I had the same problem, It is solved when I use WSL in current directory to run docker build
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!
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.
This worked for me
