containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.83k stars 2.42k forks source link

Podman secret mount error in Windows #24303

Open hadestructhor opened 1 month ago

hadestructhor commented 1 month ago

Issue Description

I think my issue is related to this closed issue. I'm on windows and trying to mount a secret into an image I'm building but it doesn't work. I tried building the secret in a compose file and using podman compose with the 1.2.0 version but it doesn't work either. I think the problem comes from how secrets are mounted in podman.

Steps to reproduce the issue

I first created a secret named rsa_private_key using podman secret create rsa_private_key ./rsa_private_key.txt which gave me the following output: 4bf444f9a65ec70ce89c41fd9.

Running podman secret ls shows the secret does exist:

ID                         NAME             DRIVER      CREATED         UPDATED
4bf444f9a65ec70ce89c41fd9  rsa_private_key  file        16 minutes ago  16 minutes ago

I tried running this simple Containerfile:

FROM ubuntu:23.04
RUN --mount=type=secret,id=rsa_private_key cat /run/secrets/rsa_private_key

Then I simply run podman build -t testimage ..

Describe the results you received

And I keep getting this output when running podman build -t testimage .:

STEP 1/2: FROM ubuntu:23.04
STEP 2/2: RUN --mount=type=secret,id=rsa_private_key cat /run/secrets/rsa_private_key
cat: /run/secrets/rsa_private_key: No such file or directory
Error: building at STEP "RUN --mount=type=secret,id=rsa_private_key cat /run/secrets/rsa_private_key": while running runtime: exit status 1

Describe the results you expected

I expected the image to be created with no issue but it seems like mounting secrets on windows does not work.

podman info output

host:
  arch: amd64
  buildahVersion: 1.37.3
  cgroupControllers: []
  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: 93.29
    systemPercent: 2.11
    userPercent: 4.6
  cpus: 4
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: container
    version: "40"
  eventLogger: journald
  freeLocks: 2044
  hostname: DESKTOP-IKDH40B
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
  kernel: 5.15.153.1-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: journald
  memFree: 1388666880
  memTotal: 4015656960
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.12.2-2.fc40.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.12.2
    package: netavark-1.12.2-1.fc40.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.12.2
  ociRuntime:
    name: crun
    package: crun-1.17-1.fc40.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.17
      commit: 000fa0d4eeed8938301f3bcf8206405315bc1017
      rundir: /run/user/1000/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^20240906.g6b38f07-1.fc40.x86_64
    version: |
      pasta 0^20240906.g6b38f07-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: /run/user/1000/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: true
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 1054744576
  swapTotal: 1073741824
  uptime: 2h 6m 20.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: /home/user/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphRootAllocated: 1081101176832
  graphRootUsed: 8252596224
  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: 41
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 5.2.3
  Built: 1727136000
  BuiltTime: Tue Sep 24 02:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.7
  Os: linux
  OsArch: linux/amd64
  Version: 5.2.3

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

I'm running it locally.

Additional information

I ran the podman version command and this is the output I'm getting:

Client:       Podman Engine
Version:      5.2.4
API Version:  5.2.4
Go Version:   go1.23.2
Git Commit:   76d0859d9f6e5d7c84392da9dcd2fae3447f789d
Built:        Mon Oct  7 18:09:24 2024
OS/Arch:      windows/amd64

Server:       Podman Engine
Version:      5.2.3
API Version:  5.2.3
Go Version:   go1.22.7
Built:        Tue Sep 24 02:00:00 2024
OS/Arch:      linux/amd64
github-actions[bot] commented 18 hours ago

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