-
Notifications
You must be signed in to change notification settings - Fork 309
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
nerdctl build
on Windows cannot use alternative Dockerfile with absolute path
#8190
Comments
I could not reproduce the problem or maybe I am doing something wrong In powershell Windows 11, Rancher desktop 1.18.0-35-g18b15b35b PS C:\temp\borrame-issue-8190> cat .\Dockerfile.custom
FROM alpine:latest
RUN apk add --no-cache curl bash
RUN echo "Hi Docker!" > /mensaje.txt
CMD ["bash", "-c", "cat /mensaje.txt && echo 'Executing...' && sleep infinity"]
PS C:\temp\borrame-issue-8190> nerdctl build --tag mytag . --file Dockerfile.custom
[+] Building 0.6s (7/7)
[+] Building 0.7s (7/7) FINISHED
=> [internal] load build definition from Dockerfile.custom 0.0s
=> => transferring dockerfile: 217B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 0.5s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/3] FROM docker.io/library/alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c 0.0s
=> => resolve docker.io/library/alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c 0.0s
=> CACHED [2/3] RUN apk add --no-cache curl bash 0.0s
=> CACHED [3/3] RUN echo "Hi Docker!" > /mensaje.txt 0.0s
=> exporting to docker image format 0.1s
=> => exporting layers 0.0s
=> => exporting manifest sha256:962b3f8445ba3699ea077ab4210459f2c626d24d156508f88db571aa7344d01f 0.0s
=> => exporting config sha256:827b928fded9762f1bd8dcaa4ab49eb19d2972566272dc177ccb293a8dbfdf21 0.0s
=> => sending tarball 0.1s
Loaded image: docker.io/library/mytag:latest |
I can reproduce the error on Rancher Desktop 1.17.1: C:\Users\SUSE\tmp>nerdctl build --tag mytag . --file Dockerfile.custom
FATA[0000] lstat /Dockerfile.custom: no such file or directory
C:\Users\SUSE\tmp>nerdctl build --tag mytag . --file c:\Users\SUSE\tmp\Dockerfile.custom
FATA[0000] lstat /c:\Users\SUSE\tmp\Dockerfile.custom: no such file or directory With 1.18.0 the first command now works, but the second one is still broken, albeit differently: C:\Users\SUSE\tmp>nerdctl build --tag mytag . --file c:\Users\SUSE\tmp\Dockerfile.custom
FATA[0000] lstat /mnt/c/Users/SUSE/tmp/c:\Users\SUSE\tmp\Dockerfile.custom: no such file or directory |
my specific use case seems to work now with 1.18.0, but @jandubois is right, the absolute path is still broken. Should we leave this issue open for this? |
Yes, please leave it open; otherwise we would have to just create another one. |
nerdctl build
on Windows cannot use alternative Dockerfile with absolute path
I posted this comment by mistake on issue #6916. I am now posting it here, where it belongs. I have not determined exactly where in the code the bug resides, but I have checked what is happening: When executing nerdctl build --tag mytag . --file C:\temp\borrame-issue-8190\Dockerfile.custom` The nerdctl stub receives these arguments as expected:
And transform them them with this result to be executed inside the WSL rancher-desktop distribution:
So the command that is executed in Linux is:
Which results in the error:
The issue here is that the parser in the stub is not transforming the
I had not time to go deeper into the issue yet. The fact that |
We stopped parsing at the first non-option argument, so
Would work. This might need to change, of course, but that means we need to figure out how to deal with args that get passed to the child (e.g. |
Just brainstorming here, but how about:
Or are you talking about passing a Windows path as a parameter to the container entrypoint command? I don't see how that could ever work. You are supposed to bind directories into the container, and then only reference files relative to the mountpoints. So we should never need to translate the args to the container command. |
Actual Behavior
Command:
nerdctl build --tag mytag . --file Dockerfile.custom
this always fails with
so it puts a / in front of whatever you specify - so even with a context of ".", it cannot find the file.
Trying to use an absolute path doesn't work either, as it seems to convert it weirdly:
nerdctl build --tag mytag . --file /d/repos/Dockerfile.cypress
Steps to Reproduce
Result
Expected Behavior
nerdctl builds with the custom dockerfile just like it successfully builds with a file called "Dockerfile"
Additional Information
No response
Rancher Desktop Version
1.17.1
Rancher Desktop K8s Version
1.32.1
Which container engine are you using?
containerd (nerdctl)
What operating system are you using?
Windows
Operating System / Build Version
Windows 11 23H2 Build 22631.4751
What CPU architecture are you using?
x64
Linux only: what package format did you use to install Rancher Desktop?
None
Windows User Only
FortiVPN is active most of the time.
The text was updated successfully, but these errors were encountered: