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
docker COPY command broken when running script inside windows environment #47231
Comments
Can you post the error-message you're getting? Are you only getting this error through I know there were some fixes in Docker Compose 2.24.3 related to paths on Windows, so wondering if related in any way; |
I can reproduce this with DD 4.27 / Compose 2.24.3 on Windows 11. $ docker compose build
2024/01/26 11:50:50 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
[+] Building 1.1s (9/11) docker:default
=> [good internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 99B 0.0s
=> [bad internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 95B 0.0s
=> [bad internal] load metadata for docker.io/library/ubuntu:22.04 0.7s
=> [good auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [good internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [bad internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> ERROR [bad internal] load build context 0.1s
=> => transferring context: 33B 0.0s
=> CANCELED [good 1/2] FROM docker.io/library/ubuntu:22.04@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e 0.2s
=> => resolve docker.io/library/ubuntu:22.04@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7dd06 0.1s
=> [good internal] load build context 0.2s
=> => transferring context: 2B 0.0s
------
> [bad internal] load build context:
------
failed to solve: changes out of order: "bad/Dockerfile" "" It does NOT fail with The |
Hello. Thanks for the replies.
In addition to the previous reply:
gives following result when trying to execute docker compose build: PS C:\Users\nfrmtk\Downloads\broken-docker> docker compose build bad
2024/01/27 02:28:10 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
2024/01/27 02:28:10 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
[+] Building 0.7s (6/6) FINISHED docker:default
=> [bad internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 93B 0.0s
=> [bad internal] load metadata for docker.io/library/ubuntu:22.04 0.6s
=> [bad internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [bad internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [bad 1/2] FROM docker.io/library/ubuntu:22.04@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d4 0.0s
=> ERROR [bad 2/2] COPY bad/a/b h.txt 0.0s
------
> [bad 2/2] COPY bad/a/b h.txt:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref 39487139-b768-4da2-afc6-13b22c4860de::to427auqx9vhnffdswgoi2gjx: failed to walk /var/lib/docker/tmp/buildkit-mount2377300442/bad/a: lstat /var/lib/docker/tmp/buildkit-mount2377300442/bad/a: no such file or directory the output doesn't depend on existence of directory bad/a/b Also, you can get following error: PS C:\Users\nfrmtk\Downloads\broken-docker> docker compose build bad
2024/01/27 02:42:43 http2: server: error reading preface from client //./pipe/docker_engine: file has already been closed
[+] Building 0.4s (6/6) FINISHED docker:default
=> [bad internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 101B 0.0s
=> [bad internal] load metadata for docker.io/library/ubuntu:22.04 0.3s
=> [bad internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [bad internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> [bad 1/2] FROM docker.io/library/ubuntu:22.04@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7 0.0s
=> ERROR [bad 2/2] COPY a/b/c/d/e/f/g/h.txt f.txt 0.0s
------
> [bad 2/2] COPY a/b/c/d/e/f/g/h.txt f.txt:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref 39487139-b768-4da2-afc6-13b22c4860de::lwwjg3u6u1r608ksfatr9gtx0: "/a/b/c/d/e/f/g/h.txt": not found by changing docker-compose.yml to following; version: "3"
services:
good:
build:
dockerfile: Dockerfile
context: good
image: good
bad:
build:
context: ..
dockerfile: broken-docker/bad/Dockerfile
image: bad and bad/Dockerfile to following:
The error message does not depend on existance of path on host pc. |
As discussed internally, this error seems fixed with this change but then we got:
The leading slash in
When vendoring tonistiigi/fsutil@master...crazy-max:fsutil:ci-windows-gogo (same as tonistiigi/fsutil#173 but keep gogo) I now get the
|
After debugging with dlv I see src and dest are wrong: A leading slash is added for both of them. It looks related to this change in |
Looks like a fix was just checked in that is possibly related... |
Fixed by docker/compose#11426 |
Are you sure? Docker Compose version 2.24.5 still exhibits the same problem, and I'm running into this issue on Linux and not Windows.
|
That looks like a very different error; here's the original errors (split up by each wrapped error);
And
Compared to the error you posted;
|
Yep I think the source of this bug was #47210 Now to wait for package managers to catch up... |
Description
docker compose build command fails with correct Dockerfile using windows.
same command works inside wsl.
docker-compose.yml:
bad/Dockerfile:
good/Dockerfile:
Reproduce
broken-docker.zip
docker compose build bad
Expected behavior
image should be built correcrtly
docker version
Client: Cloud integration: v1.0.35+desktop.10 Version: 25.0.1 API version: 1.44 Go version: go1.21.6 Git commit: 29cf629 Built: Tue Jan 23 23:10:35 2024 OS/Arch: windows/amd64 Context: default Server: Docker Desktop 4.27.0 (135262) Engine: Version: 25.0.1 API version: 1.44 (minimum version 1.24) Go version: go1.21.6 Git commit: 71fa3ab Built: Tue Jan 23 23:09:46 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.27 GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59 runc: Version: 1.1.11 GitCommit: v1.1.11-0-g4bccb38 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
COPY works correclty when trying to transfer file from the folder of build context(see good/Dockerfile)
error messages apperaing when trying to build image are different when changing nest level of file being transfered via COPY.
The text was updated successfully, but these errors were encountered: