Closed leadoflife closed 2 months ago
Different, but related issue #10100 with a similar file system issue and notes on buildah
as well as reproducing with rootless and root. Though no obvious hints (to me) on how to fix are apparent. The notes on RHEL and Alpine make me wonder if the Fedora virtual that Podman is running on in WSL might have a similar kernal and/or buildah
issue. But, the error seems to be in mapping the Windows file system path to the underlying Linux paths... so, it's likely in the Podman path mapping code.
I'm not a RedHat subscriber, but the paywall solution behind this article may prove useful if someone is a subscriber: https://access.redhat.com/solutions/6958392
While the above is still a valid bug, a work-around to enable multi-context builds is to copy the files / directories into a tagged image and then use the aliased container build context to reference those files.
Example:
"./shared/Containerfile"
FROM docker.io/library/debian:11.7-slim
COPY ./1st/ /usr/src/a/
COPY ./2nd/ /usr/src/b/
VOLUME [ "/usr/src/a/", "/usr/src/b/" ]
"./multi-context-build/Containerfile"
FROM docker.io/library/debian:11.7-slim
COPY --from=libraries /usr/src/a/ /usr/src/a/
COPY --from=libraries /usr/src/b/ /usr/src/b/
cd ./shared/ && podman build --tag my-shared .
cd ./multi-context-build/ && podman build --build-context libraries=container-image://localhost/my-shared .
Astute readers may note there are simpler methods to structure the volume and to COPY
, but this contrived example was intended to suggest that each shared directory could be named anything and could use any potential path on the file system.
@flouthoc PTAL
A friendly reminder that this issue had no activity for 30 days.
Facing with same error:
Error: building at STEP "COPY --from=ext . .": checking on sources under "/C:\\Users\\user\\work\\proj\\ext": error in copier subprocess: changing to intended-new-root directory "/C:\\Users\\user\\work\\proj\\ext": chdir /C:\Users\user\work\proj\ext: no such file or directory
when I provided --build-context=ext=../ext
- to escape from the build context when referring to external files. The command is:
COPY --from=ext . .
Windows 10. podman.exe version 4.7.1.
Seems handling of Windows paths is broken for podman cp
too: https://stackoverflow.com/questions/77085191/how-can-i-copy-paste-files-into-a-wsl-podman-container
This issue has been fixed when the machine provider is WSL (the default) but it's still failing when the machine provider is Hyper-V. I am closing it as there is an Hyper-V dedicated issue to track that problem.
Issue Description
Using the argument
--build-context
fails on Windows with Podman + WSL.With debug logging...
Steps to reproduce the issue
Steps to reproduce the issue
--build-context
argumentBoth
cmd
and "Git BASH" produce errors. Using both helps rule out "pure" Linux path vs. Windows path issues.Describe the results you received
Given a file and directory structure of:
Single, alternative build context
Where, "./Containerfile" contains steps for a single, alternative context build:
Using
cmd
...Using "Git BASH"...
Multiple context build
Where, "./Containerfile" contains steps for a multiple context build:
Using
cmd
...Using "Git BASH"...
... both
cmd
and "Git BASH" fail on the first entry, but this is included as an important use case that proves 1) multiple build contexts as well as a path up and back down through a different directory structure.Describe the results you expected
Files get copied successfully from each aliased build context.
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Windows System
System specifications
Additional information
No response