Closed faitz closed 3 years ago
Theory: we're probably validating client-side, using the Go filepath library, which is using Windows path standards instead of Linux, so expecting drive letters and backslash separators. Easiest solution is probably to move the validation to the server.
A friendly reminder that this issue had no activity for 30 days.
@flouthoc PTAL
@rhatdan Destination path inside containers should be always validated as *nixtype absolute path. So I think check should be fixed.
So its recommended to use path.IsAbs() instead of filtepath.IsAbs() for destination checks. Since filepath.IsAbs() will use path_windows on windows host but destination path inside the containers should always be of *nix type.
Reference: https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/path/path.go;l=219 https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/path/filepath/path_windows.go https://cs.opensource.google/go/go/+/refs/tags/go1.16.7:src/path/filepath/path_unix.go
but we should also move this to server side as @mheon suggested but above PR fixes the use case.
We can prefer as final fix https://github.com/containers/podman/pull/11231 i.e what @mheon suggested.
Can someone double check if this is fixed in 3.4.4? I still get this error on windows (remote client) and linux (via TCP).
@asbachb Is your client
and remote
both on 3.4.4
. Could you show the command and the error
.
@flouthoc
PS C:\dev\src\java\amadeus-bahn-jboss-migration\nps2> podman version
Client:
Version: 3.4.4
API Version: 3.4.4
Go Version: go1.16.8
Git Commit: f6526ada1025c2e3f88745ba83b8b461ca659933
Built: Wed Dec 8 22:14:28 2021
OS/Arch: windows/amd64
Server:
Version: 3.4.4
API Version: 3.4.4
Go Version: go1.16.10
Built: Tue Jan 1 01:00:00 1980
OS/Arch: linux/amd64
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/tmp/hello.txt alpine cat
Error: invalid container path "\\tmp\\hello.txt", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/tmp/ alpine cat
Error: invalid container path "\\tmp", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/tmp alpine cat
Error: invalid container path "\\tmp", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/ alpine cat
Error: invalid container path "\\", must be an absolute path
PS C:\dev\tmp\podman-test> podman run --mount=type=bind,source=C:\dev\tmp\podman-test\hello.txt,destination=/ alpine cat
@asbachb What you are trying is bind
mounting from a windows
host into linux
podman machine. This feature is currently not supported and more on mounting files from host to remote
is being discussed here: https://github.com/containers/podman/issues/8016
@flouthoc Ah thanks for clarification. I guess the error message was kind of confusing for me as it indicates a problem on guest side.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Cannot create a container with mounted volume, podman is validating destination path using absolute path, on UNIX system absolute path always starts with a slash
/
, but on windows, it started with a drive letter. so podman always give an errorError: invalid container path "/data", must be an absolute path
Steps to reproduce the issue:
Create and run container using podman remote windows
podman run -it --rm -v /mnt/i/source:/data fedora bash
Describe the results you received:
Got an error:
Describe the results you expected:
container should be running and
/mnt/i/soruce
mounted to/data
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
No
Additional environment details (AWS, VirtualBox, physical, etc.):
Podman server running on VirtualBox using Centos Stream 8