podman icon indicating copy to clipboard operation
podman copied to clipboard

Incorrect parsing of Windows hostPath volume with `podman kube play`

Open maxim-v4s opened this issue 3 years ago • 9 comments

/kind bug

Description

In the process of calling podman kube play podman on Windows tries mount host path from /home/user/<host_path> instead of /mnt/<host_path>.

Steps to reproduce the issue:

  1. Create pod file test.yaml
apiVersion: apps/v1
kind: Pod
metadata:
  name: test
  labels:
    app: test
spec:
  containers:
    - name: main
      image: "alpine"
      volumeMounts:
        - mountPath: /home/data/
          name: test-hostpath0
  restartPolicy: Always
  volumes:
    - hostPath:
        path: C:\Users\test\Documents\vol
        type: Directory
      name: test-hostpath0
  1. Create host dir C:\Users\test\Documents\vol

  2. podman play kube .\test.yaml

Describe the results you received:

Error: playing YAML file: statfs /home/user/C:\Users\test\Documents\vol\: no such file or directory

Describe the results you expected: Alpine container will run and exit.

Additional information you deem important: Dir C:\Users\test\Documents\vol\ is created in /home/user/ if use DirectoryOrCreate volume type.

In case of running container manually podman run --rm -it -v C:\Users\test\Documents\vol:/home/data alpine host path will be /mnt/c/Users/test/Documents/vol

Output of podman version:

Client:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.18.5
Git Commit:   814b7b003cc630bf6ab188274706c383f9fb9915
Built:        Thu Nov 10 06:18:45 2022
OS/Arch:      windows/amd64

Server:       Podman Engine
Version:      4.3.1
API Version:  4.3.1
Go Version:   go1.18.7
Built:        Fri Nov 11 07:24:13 2022
OS/Arch:      linux/amd64

Output of podman info:

host:
  arch: amd64
  buildahVersion: 1.28.0
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.5-1.fc36.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.5, commit: '
  cpuUtilization:
    idlePercent: 97.65
    systemPercent: 1.72
    userPercent: 0.63
  cpus: 8
  distribution:
    distribution: fedora
    variant: container
    version: "36"
  eventLogger: journald
  hostname: win10-2
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.10.102.1-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: journald
  memFree: 6021038080
  memTotal: 6640676864
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.7-1.fc36.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.7
      commit: 40d996ea8a827981895ce22886a9bac367f87264
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-0.2.beta.0.fc36.x86_64
    version: |-
      slirp4netns version 1.2.0-beta.0
      commit: 477db14a24ff1a3de3a705e51ca2c4c1fe3dda64
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 2147483648
  swapTotal: 2147483648
  uptime: 1h 24m 6.00s (Approximately 0.04 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 1
    stopped: 1
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphRootAllocated: 269490393088
  graphRootUsed: 655949824
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 2
  runRoot: /run/user/1000/containers
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 4.3.1
  Built: 1668180253
  BuiltTime: Fri Nov 11 07:24:13 2022
  GitCommit: ""
  GoVersion: go1.18.7
  Os: linux
  OsArch: linux/amd64
  Version: 4.3.1

Package info (e.g. output of rpm -q podman or apt list podman or brew info podman):

Running on Windows (installer version: v4.3.1).

WSL output:

podman-4.3.1-1.fc36.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

Virtual machine: Gnome Boxes. Windows version: 10.0.19044 N/A Build 19044

maxim-v4s avatar Dec 01 '22 14:12 maxim-v4s

@n1hility PTAL

mheon avatar Dec 05 '22 21:12 mheon

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jan 05 '23 00:01 github-actions[bot]

This and another area need to be enhanced for path transformation. In the meantime, you should be able to work around this by using the path /mnt/c/Users/test/Documents/vol

n1hility avatar Jan 05 '23 04:01 n1hility

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Feb 05 '23 00:02 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Mar 14 '23 00:03 github-actions[bot]

@n1hility any update on this one?

rhatdan avatar Mar 15 '23 15:03 rhatdan

will take a look this weekend

n1hility avatar Mar 17 '23 20:03 n1hility

4.6.1 still has this issue - thank you all for looking into it! In my use case, due to this, it is not possible to create a YAML file for podman play kube that'd support both Windows and Linux.

dnso86 avatar Sep 06 '23 08:09 dnso86

I can confirm that the problem still exists on Podman v5.4.0. Like my previous commentator said, it would have been very nice to handle this case in both systems equally. Thanks for workaround in https://github.com/containers/podman/issues/16704#issuecomment-1371763628

Kamilll avatar Mar 17 '25 17:03 Kamilll