Skip to content

subpath option in compose files gets silently ignored (with docker compose) #25992

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

Closed
awmath opened this issue Apr 26, 2025 · 1 comment
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@awmath
Copy link

awmath commented Apr 26, 2025

Issue Description

The subpath option for volumes with docker-compose get's silently ignored.

There have been comments about this in #20661. But this Issue has been closed since podman 5.4.0 added support for volume subpaths using podman run/create ---mount ...subPath=.

There has also been support for subpaths with podman kube play #16803 which works fine.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Install docker-compose
  2. Use the following compose.yml
services:
  create-data:
    image: alpine
    command:
      - ash
      - -c
      - |
        mkdir -p /mnt/sub  
        echo "full" > /mnt/testfile
        echo "sub" > /mnt/sub/testfile
    volumes:
      - data:/mnt

  test-full:
    image: alpine
    command: cat /mnt/testfile
    depends_on:
      create-data:
        condition: service_completed_successfully
    volumes:
      - type: volume
        source: data
        target: /mnt

  test-subpath:
    image: alpine
    command: cat /mnt/testfile
    depends_on:
      create-data:
        condition: service_completed_successfully
    volumes:
      - type: volume
        source: data
        target: /mnt
        volume:
          subpath: sub/

volumes:
  data:
  1. podman compose up

Describe the results you received

test-full and test-subpath services will echo "full"

Describe the results you expected

test-full should echo "full" and test-subpath should echo "sub".

podman run --rm -it --mount type=volume,source=podman-compose-subvolume_data,target=/mnt,subpath=sub alpine cat /mnt/testfile does in fact return "sub"

podman info output

host:
  arch: amd64
  buildahVersion: 1.39.4
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.13-1.fc41.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.13, commit: '
  cpuUtilization:
    idlePercent: 96.37
    systemPercent: 0.94
    userPercent: 2.68
  cpus: 16
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    variant: workstation
    version: "41"
  eventLogger: journald
  freeLocks: 1957
  hostname: user.fedora
  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: 6.13.9-200.fc41.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 11591798784
  memTotal: 65067012096
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.14.0-1.fc41.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.14.0
    package: netavark-1.14.1-1.fc41.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.14.1
  ociRuntime:
    name: crun
    package: crun-1.20-2.fc41.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.20
      commit: 9c9a76ac11994701dd666c4f0b869ceffb599a66
      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^20250320.g32f6212-2.fc41.x86_64
    version: ""
  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: true
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 8587046912
  swapTotal: 8589930496
  uptime: 175h 43m 43.00s (Approximately 7.29 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 24
    paused: 0
    running: 4
    stopped: 20
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphRootAllocated: 1022505254912
  graphRootUsed: 817701429248
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 119
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 5.4.2
  BuildOrigin: Fedora Project
  Built: 1743552000
  BuiltTime: Wed Apr  2 02:00:00 2025
  GitCommit: be85287fcf4590961614ee37be65eeb315e5d9ff
  GoVersion: go1.23.7
  Os: linux
  OsArch: linux/amd64
  Version: 5.4.2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

No response

@ninja-quokka
Copy link
Collaborator

Hey @awmath, thanks for reporting! Closing this one as the other issue you opened: containers/podman-compose#1188 is the correct place to continue.

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.
Projects
None yet
Development

No branches or pull requests

2 participants