Skip to content
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

Relative paths with 'podman kube play' not working on Windows #25437

Open
rgaiacs opened this issue Mar 2, 2025 · 2 comments
Open

Relative paths with 'podman kube play' not working on Windows #25437

rgaiacs opened this issue Mar 2, 2025 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. remote Problem is in podman-remote

Comments

@rgaiacs
Copy link

rgaiacs commented Mar 2, 2025

Issue Description

Based on #17177, use of relative paths is supported by podman kube play but I'm encountering

Error: playing YAML file: statfs /html: no such file or directory

Steps to reproduce the issue

  1. cd $(mktemp -d)
  2. mkdir html
  3. create the nginx.kube containing
apiVersion: v1
kind: Pod
metadata:
  labels:
    app: nginx-wme
  name: nginx-wme
spec:
  containers:
  - args:
    - nginx
    - -g
    - daemon off;
    image: docker.io/library/nginx:alpine
    name: nginx
    ports:
    - containerPort: 80
      hostPort: 8080
    volumeMounts:
    - mountPath: /usr/share/nginx/html
      name: nginx-html
  volumes:
  - hostPath:
      path: ./html
      type: Directory
    name: nginx-html
  1. create the nginx.kube containing
<!DOCTYPE html>
<html>
    <body>
        <h1>Hello!</h1>
    </body>
</html>
  1. Run podman kube play --replace nginx.kube

Describe the results you received

Error: playing YAML file: statfs /html: no such file or directory

Describe the results you expected

The directory html is bind mounted to the container.

podman info output

Client:
  APIVersion: 5.4.0
  Built: 1739297059
  BuiltTime: Tue Feb 11 19:04:19 2025
  GitCommit: f9f7d48b24b1ca4403f189caaeab1cb8ff4a9aa2
  GoVersion: go1.23.6
  Os: linux
  OsArch: linux/amd64
  Version: 5.4.0
host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers:
  - cpuset
  - cpu
  - cpuacct
  - blkio
  - memory
  - devices
  - freezer
  - net_cls
  - perf_event
  - net_prio
  - hugetlb
  - pids
  - rdma
  - misc
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.12-2.fc40.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 98.18
    systemPercent: 0.74
    userPercent: 1.08
  cpus: 8
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: container
    version: "40"
  eventLogger: journald
  freeLocks: 2032
  hostname: KOL22104
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.15.167.4-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: journald
  memFree: 2873040896
  memTotal: 8185208832
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.1-1.fc40.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.13.1
    package: netavark-1.13.1-1.fc40.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.13.1
  ociRuntime:
    name: crun
    package: crun-1.19.1-1.fc40.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.19.1
      commit: 3e32a70c93f5aa5fea69b50256cca7fd4aa23c80
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20241211.g09478d5-1.fc40.x86_64
    version: |
      pasta 0^20241211.g09478d5-1.fc40.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: unix:///run/podman/podman.sock
  rootlessNetworkCmd: pasta
  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: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: true
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 2147483648
  swapTotal: 2147483648
  uptime: 2h 13m 29.00s (Approximately 0.08 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 3
    paused: 0
    running: 0
    stopped: 3
  graphDriverName: overlay
  graphOptions:
    overlay.imagestore: /usr/lib/containers/storage
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 1081101176832
  graphRootUsed: 2976186368
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 7
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 5.3.1
  Built: 1732147200
  BuiltTime: Thu Nov 21 01:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.7
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.1

Podman in a container

Yes

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

I'm running Podman Desktop on Windows with WSL2 and the default Podman Machine. From Podman Desktop GUI, it is possible to successfully use

  volumes:
  - hostPath:
      path: /mnt/c/Users/costadre/Downloads/nginx-mwe/html
      type: Directory

I want to use a relative path from the .kube file to make the developer experience across machines more easy as it is with Docker Compose where the instructions to the user is only "run docker compose up".

Additional information

No response

@rgaiacs rgaiacs added the kind/bug Categorizes issue or PR as related to a bug. label Mar 2, 2025
@github-actions github-actions bot added the remote Problem is in podman-remote label Mar 2, 2025
@rgaiacs rgaiacs changed the title Relative paths with 'podman kube play' not working Relative paths with 'podman kube play' not working on Windows Mar 2, 2025
@rgaiacs
Copy link
Author

rgaiacs commented Mar 2, 2025

I investigated this more. In a unstable Debian WSL2 machine

$ uname -a
Linux KOL22104 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 GNU/Linux

with Podman 5.4.0 running on the Debian WSL2 machine instead of the Default Podman Machine, the minimal working example provided in the first report work as expected.

My understanding is that when accessing Podman from Windows or accessing Podman from another WSL distribution, the podman-remote is not aware of the client environment. Would be awesome if podman-remote had some built-in rules to improve the Windows or WSL user experience. For example, if podman-remote is called in from C:\Users\username\Downloads\nginx-mwe, podman-remote will transmit the path /mnt/c/Users/username/Downloads/nginx-mwe.

podman info output

WARN[0000] Using cgroups-v1 which is deprecated in favor of cgroups-v2 with Podman v5 and will be removed in a future version. Set environment variable `PODMAN_IGNORE_CGROUPSV1_WARNING` to hide this warning.
host:
  arch: amd64
  buildahVersion: 1.39.0
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon_2.1.12-4_amd64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: unknown'
  cpuUtilization:
    idlePercent: 98.3
    systemPercent: 0.67
    userPercent: 1.03
  cpus: 8
  databaseBackend: sqlite
  distribution:
    codename: trixie
    distribution: debian
    version: unknown
  eventLogger: file
  freeLocks: 2045
  hostname: KOL22104
  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.15.167.4-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: k8s-file
  memFree: 873111552
  memTotal: 8185208832
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns_1.12.2-2_amd64
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.12.2
    package: netavark_1.12.1-9_amd64
    path: /usr/lib/podman/netavark
    version: netavark 1.12.1
  ociRuntime:
    name: crun
    package: crun_1.20-1_amd64
    path: /usr/bin/crun
    version: |-
      crun version 1.20
      commit: 9c9a76ac11994701dd666c4f0b869ceffb599a66
      rundir: /mnt/wslg/runtime-dir/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt_0.0~git20250217.a1e48a0-1_amd64
    version: ""
  remoteSocket:
    exists: true
    path: /mnt/wslg/runtime-dir/podman/podman.sock
  rootlessNetworkCmd: pasta
  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: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns_1.2.1-1+b1_amd64
    version: |-
      slirp4netns version 1.2.1
      commit: 09e31e92fa3d2a1d3ca261adaeb012c8d75a8194
      libslirp: 4.8.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.5
  swapFree: 2147483648
  swapTotal: 2147483648
  uptime: 10h 59m 26.00s (Approximately 0.42 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/raniere/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 2
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/raniere/.local/share/containers/storage
  graphRootAllocated: 1081101176832
  graphRootUsed: 2862845952
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 2
  runRoot: /mnt/wslg/runtime-dir/containers
  transientStore: false
  volumePath: /home/raniere/.local/share/containers/storage/volumes
version:
  APIVersion: 5.4.0
  Built: 1739713871
  BuiltTime: Sun Feb 16 14:51:11 2025
  GitCommit: ""
  GoVersion: go1.24.0
  Os: linux
  OsArch: linux/amd64
  Version: 5.4.0

@Luap99
Copy link
Member

Luap99 commented Mar 3, 2025

The kube api accepts the raw bytes of the kube yaml file. The remote client does not parse the file (and shouldn't have to). The podman service then sees a relative path and resolves it based on its own cwd (likely /) so it doesn't work. The service cannot know what the cwd of the client was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. remote Problem is in podman-remote
Projects
None yet
Development

No branches or pull requests

2 participants