I use fstab, seems cleaner instead of relying on podman. Otherwise can you give the podman user permissions to mount volumes?
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil.
-
No spam.
-
Posts are to be related to self-hosting.
-
Don't duplicate the full text of your blog or readme if you're providing a link.
-
Submission headline should match the article title.
-
No trolling.
-
Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
It's not possible to mount NFS shares without root (a rootful container would work but I don't recommend it). Docker allows it because it implicitly runs as root. Cleanest solution is to mount it from the host's fstab and use a bind mount.
You can mount NFS shares as non-root user, look it up some more.
What trips people is that it needs some extra configuration on both server and client, the UID needs to match, and the user needs to own the mountpoint dir.
The error message from NFS ("only root can do that") doesn't help either.
Can you really? I'd love some pointers on that. I'll try to look it up more, thanks
Update: I took some suggestions and ideas from the comments here and built a system for this:
- Create the mountpoint directories
- Add the mounts to /etc/fstab with the
user,noautooption - I'm using quadlets, so add a new
[service]section to my container file and addExecStartPreandExecStopPostentries with mount and umount commands - Add bind mount volumes to the NFS shares pointing to the local mountpoint
This allows me to have the mounts only active when the container is running. And I can still have rootless podman containers. Seems to be working well in the limited testing I did yesterday.
I've had issues with this too and reverted back to rooted docker. I even tried podman and system NFS mounts that it binds too with varying issues.
It looks like you can't actually do this with podman for varying reasons.