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

Podman cannot create container when an overlay volume has additional arguments #14427

Closed
haakobja opened this issue May 31, 2022 · 4 comments · Fixed by #14474
Closed

Podman cannot create container when an overlay volume has additional arguments #14427

haakobja opened this issue May 31, 2022 · 4 comments · Fixed by #14474
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@haakobja
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

I'm trying to create a container where I mount a volume as an overlay of $HOME/.local, but the overlay volume is not persistent. According to the documentation, I should be able to add some additional configuration parameters to get the volume mount to be persistent. Unfortunately, that doesn't work as expected.

Steps to reproduce the issue:

  1. Create a pod with the following argument--volume="/dir:/dir:O,upperdir=/mnt/upper,workdir=/mnt/work". Make sure the directories exists

Describe the results you received:
Error message: Error: can't use 'O' with other options

Describe the results you expected:
The container should have been created as it is described in the podman documentation

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Client:       Podman Engine
Version:      4.1.0
API Version:  4.1.0
Go Version:   go1.18
Built:        Fri May  6 18:15:54 2022
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.26.1
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc36.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpuUtilization:
    idlePercent: 80.84
    systemPercent: 3.86
    userPercent: 15.3
  cpus: 12
  distribution:
    distribution: fedora
    variant: workstation
    version: "36"
  eventLogger: journald
  hostname: TON-HOJA01-VPC
  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.17.11-300.fc36.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 16428404736
  memTotal: 33435189248
  networkBackend: cni
  ociRuntime:
    name: crun
    package: crun-1.4.5-1.fc36.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.5
      commit: c381048530aa750495cf502ddb7181f2ded5b400
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +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: true
  serviceIsRemote: false
  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: 8589930496
  swapTotal: 8589930496
  uptime: 18h 56m 11.54s (Approximately 0.75 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/hakon.botnmark.jahre/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/hakon.botnmark.jahre/.local/share/containers/storage
  graphRootAllocated: 145726898176
  graphRootUsed: 37949427712
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 18
  runRoot: /run/user/1000/containers
  volumePath: /home/hakon.botnmark.jahre/.local/share/containers/storage/volumes
version:
  APIVersion: 4.1.0
  Built: 1651853754
  BuiltTime: Fri May  6 18:15:54 2022
  GitCommit: ""
  GoVersion: go1.18
  Os: linux
  OsArch: linux/amd64
  Version: 4.1.0

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

podman-4.1.0-1.fc36.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

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

physical

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label May 31, 2022
@Luap99
Copy link
Member

Luap99 commented May 31, 2022

@flouthoc PTAL

@haakobja
Copy link
Author

I forgot to mention that the documentation for the --volume switch differs for podman-create and podman-run.

The mention of the advanced usage of overlay mounts is only in the podman-run documentation

For advanced users overlay option also supports custom non-volatile upperdir and workdir for the overlay mount. Custom upperdir and workdir can be fully managed by the users themselves and podman will not remove it on lifecycle completion. Example :O,upperdir=/some/upper,workdir=/some/work

I assume the calls have a common code path for handling volumes

@flouthoc
Copy link
Collaborator

flouthoc commented Jun 3, 2022

Hi @haakobja , It seems this feature was only enabled for named volumes and you are attempting this feature on anonymous volume so you need to create a volume first or this PR should enable same feature for anonymous overlay volumes as well: #14474

$ podman volume create test
$ podman run -it -v test:/data:O,upperdir=/path/persistant/upper,workdir=/path/persistant/work alpine sh

So you can either wait for : #14474 or create a named overlay volume as stated above.

@haakobja
Copy link
Author

haakobja commented Jun 3, 2022

Hi @haakobja , It seems this feature was only enabled for named volumes and you are attempting this feature on anonymous volume so you need to create a volume first or this PR should enable same feature for anonymous overlay volumes as well: #14474

$ podman volume create test
$ podman run -it -v test:/data:O,upperdir=/path/persistant/upper,workdir=/path/persistant/work alpine sh

So you can either wait for : #14474 or create a named overlay volume as stated above.

I think I'll wait for the PR (didn't really think it would be implemented that quick). What I'm trying to do is to mount my home directory in a container, but I want the files to be persisted in a named volume, as I try to get my development environment to be contained within a container context. I have partially solved it by mounting a named volume as ~/.local, but it's not ideal

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants