Truenas & VM Docker Ownership Confusion

Randy Smyth

Dabbler
Joined
Apr 9, 2017
Messages
21
Current situation :
TrueNAS-SCALE-22.12.1
User : Dave (uid in Truenas 3000)
Also Created user nsfdcker:3001 (belongs to groups :Dave, docker)

Ubuntu VM
- so I can use Docker Setup for apps
- plex, radarr, sonarr, nextcloud, etc
- User : Dave (uid in Ubuntu VM 1000)
- Also Created user nsfdcker:3001 (belongs to groups :Dave, docker)
- group :docker(gid 999)

Folders :
Truenas/mnt/tank/data - Data folder for Media, with NFS and SMB shares
Owner : nfsdckr (uid 3001)
Group : docker (gid 999)

Truenas/mnt/tank/nfsdocker - folder for mapping each docker containers /config to, contains
Owner : nfsdckr (uid 3001)
Group : docker (gid 999)

What should the 2 folders on Truenas have set for Owner:group ?

What should docker-compose have for UID & GID ?

I have a heck of a time figuring out ownerships and permission, and I’ve made so many minor corrections to try and get all working together ive made a mess.
Mess started since I originally did all my dockers-compose files with a UID:GID of 1000:999. (This was because within the VM a ID command gave me my user as 1000 and from following videos these docker folder setups should be current user as user, and docker as group. So 1000:999)

When I then went into truenas folders and data sets, I set them also to the same 1000:999 unfortunately on truenas user 1000 is not Dave, its postgres on my system
Everything actually worked except I could not play Plex files that needed audio codecs. The codecs won’t execute with my current permissions.

What should ownership be on truenas datasets and in the docker compose if my user is a different UID number on truenas and Ubuntu ?
 

nutrient2314

Cadet
Joined
Jan 26, 2024
Messages
6
I have mounted NFS3 on Alpine Linux LXC (docker host) and here's my workflow.
There's no need to fiddle with users on the docker host itself. Everything has to do with the docker container (what PUID/PGID it uses) and truenas.
  1. Create a local user and make a note of its UID and GID.
  2. Give read, write and execute permissions to it on the dataset you decide to share as NFS. I simply do so by making it the owner and group of the dataset.
  3. Under "Advanced" for the NFS Sharing, select the newly created user and group as Mapall User and Mapall Group. In layman's term it essentially means if requests from the NFS clients (the docker host) or applications that operate on this share (docker containers) originate as any user (root or non-root) mold/modify them as the user/group selected.
  4. Mount the NFS. My /etc/fstab example
    Code:
    192.168.0.14:/mnt/tank/docker   /mnt/docker   nfs   defaults,timeo=900,retrans=5,_netdev    0 0
  5. Containers that have the option to define users such as those from Linuxserver, use the UID and GID as noted from step 1.
  6. Freely bind mount volumes.
 
Last edited:
Top