containers / containers/podman-compose

NFS volume not mounted using podman-compose

Open
#561 5 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

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

/kind bug

**Description**

Although podman #4303 claims to have been fixed by podman #4305, nfs volumes are not mounted, at least not with `podman-compose`.

**Steps to reproduce the issue:**

1. create `docker-compose.yaml` with following content:
```
version: '3'
services:
nginx:
image: nginxinc/nginx-unprivileged
container_name: nginxu
ports:
- 8888:8080
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
volumes:
- /docker_volumes/config/nginx:/config
- "nfs-data:/data"
restart: unless-stopped
volumes:
nfs-data:
driver: local
driver_opts:
type: nfs
o: nfsvers=4,addr=,rw
device: ":/mnt/seagate4tb/testnfs"
```
> Note: it can be any image, I chose nginx-unprivileged, arbitrarily; the important lines are in the section `nfs-data`.
2. execute `podman-compose up -d`
```
podman-compose up -d
['podman', '--version', '']
using podman version: 4.2.0
** excluding: set()
podman volume inspect root_nfs-data || podman volume create root_nfs-data
['podman', 'volume', 'inspect', 'root_nfs-data']
Error: inspecting object: no such volume root_nfs-data
['podman', 'volume', 'create', '--label', 'io.podman.compose.project=root', '--label', 'com.docker.compose.project=root', 'root_nfs-data']
['podman', 'volume', 'inspect', 'root_nfs-data']
['podman', 'network', 'exists', 'root_default']
podman run --name=nginxu -d --label io.podman.compose.config-hash=123 --label io.podman.compose.project=root --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=root --label com.docker.compose.project.working_dir=/root --label com.docker.compose.project.config_files=docker-compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=nginx -e PUID=1000 -e PGID=1000 -e TZ=Europe/London -v /docker_volumes/config/nginx:/config -v root_nfs-data:/data --net root_default --network-alias nginx -p 8888:8080 --restart unless-stopped nginxinc/nginx-unprivileged
e836a4f2c88aa4a0da5933a05109e6fd3999086943156421ad769526bd152267
exit code: 0
```
> Note the line with error message: `Error: inspecting object: no such volume root_nfs-data`
3. Execute `mount | grep nfs` to verify that nfs was mounted - or rather, that is was NOT mounted:
```
mount | grep nfs
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
```
> Note that missing nfs mount.

**Describe the results you received:**
Volume `root_nfs-data` was created but the specified nfs volume was not mounted.
To verify that the nfs mount itself works outside of podman, I ran the following:
```
mount -t nfs :/mnt/seagate4tb/testnfs testnfs
ls testnfs
foo foo1 foobar foobaz
```

Also checked `podman inspect root_nfs-data`:
```
podman inspect root_nfs-data
[
{
"Name": "root_nfs-data",
"Driver": "local",
"Mountpoint": "/var/lib/containers/storage/volumes/root_nfs-data/_data",
"CreatedAt": "2022-09-26T10:35:47.245872463-04:00",
"Labels": {
"com.docker.compose.project": "root",
"io.podman.compose.project": "root"
},
"Scope": "local",
"Options": {},
"UID": 101,
"GID": 101,
"MountCount": 0,
"NeedsCopyUp": true
}
]
```
> Note that the nfs mount options from the `docker-compose.yaml` file are missing.

**Describe the results you expected:**

Same commands using `docker-compose` and `docker inspect` show how it should be:

```
docker inspect andrev_nfs-data
[
{
"CreatedAt": "2022-09-19T18:27:58+01:00",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "andrev",
"com.docker.compose.volume": "nfs-data"
},
"Mountpoint": "/var/lib/docker/volumes/andrev_nfs-data/_data",
"Name": "andrev_nfs-data",
"Options": {
"device": ":/mnt/seagate4tb/testnfs",
"o": "nfsvers=4,addr=,rw",
"type": "nfs"
},
"Scope": "local"
}
]

```
and to prove that the nfs mount occurred:

```
$ mount | grep nfs
:/mnt/seagate4tb/testnfs on /var/lib/docker/volumes/andrev_nfs-data/_data type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.215,local_lock=none,addr=192.168.178.220)
$ docker exec -it nginxu /bin/bash
nginx@6bb2044a7412:/$ ls /data
foo foo1 foobar foobaz
nginx@6bb2044a7412:/$
```

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

**Output of `podman version`:**

Refer above: 4.2.0

**Output of `podman info`:**

```
podman info
host:
arch: arm64
buildahVersion: 1.27.0
cgroupControllers:
- cpuset
- cpu
- io
- memory
- pids
- misc
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.1.4-2.fc36.aarch64
path: /usr/bin/conmon
version: 'conmon version 2.1.4, commit: '
cpuUtilization:
idlePercent: 98.35
systemPercent: 1.01
userPercent: 0.63
cpus: 4
distribution:
distribution: fedora
variant: server
version: "36"
eventLogger: journald
hostname: rpi8.fritz.box
idMappings:
gidmap: null
uidmap: null
kernel: 5.19.10-200.fc36.aarch64
linkmode: dynamic
logDriver: journald
memFree: 6598569984
memTotal: 8206974976
networkBackend: netavark
ociRuntime:
name: crun
package: crun-1.6-2.fc36.aarch64
path: /usr/bin/crun
version: |-
crun version 1.6
commit: 18cf2efbb8feb2b2f20e316520e0fd0b6c41ef4d
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
os: linux
remoteSocket:
exists: true
path: /run/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: false
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: true
serviceIsRemote: false
slirp4netns:
executable: ""
package: ""
version: ""
swapFree: 8206151680
swapTotal: 8206151680
uptime: 5h 14m 18.00s (Approximately 0.21 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: /usr/share/containers/storage.conf
containerStore:
number: 1
paused: 0
running: 1
stopped: 0
graphDriverName: overlay
graphOptions:
overlay.mountopt: nodev,metacopy=on
graphRoot: /var/lib/containers/storage
graphRootAllocated: 22340960256
graphRootUsed: 4157538304
graphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "false"
Supports d_type: "true"
Using metacopy: "true"
imageCopyTmpDir: /var/tmp
imageStore:
number: 1
runRoot: /run/containers/storage
volumePath: /var/lib/containers/storage/volumes
version:
APIVersion: 4.2.0
Built: 1660228991
BuiltTime: Thu Aug 11 10:43:11 2022
GitCommit: ""
GoVersion: go1.18.4
Os: linux
OsArch: linux/arm64
Version: 4.2.0
```

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

```
dnf list | grep podman
cockpit-podman.noarch 53-1.fc36 @updates
podman.aarch64 4:4.2.0-2.fc36 @updates
podman-compose.noarch 1.0.3-6.fc36 @updates
podman-gvproxy.aarch64 4:4.2.0-2.fc36 @updates
podman-plugins.aarch64 4:4.2.0-2.fc36 @updates
ansible-collection-containers-podman.noarch 1.9.4-1.fc36 updates
pcp-pmda-podman.aarch64 5.3.7-4.fc36 updates
podman-docker.noarch 4:4.2.0-2.fc36 updates
podman-remote.aarch64 4:4.2.0-2.fc36 updates
podman-tests.aarch64 4:4.2.0-2.fc36 updates
podman-tui.aarch64 0.5.0-2.fc36 updates
python3-molecule-podman.noarch 1.0.1-2.fc36 fedora
python3-podman.noarch 3:4.2.0-6.fc36 updates
python3-podman-api.noarch 0.0.0-0.12.20200614gitd4b8263.fc36 fedora ```

**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.):**
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.