How to change plex GID via Docker?

indivision

Guru
Joined
Jan 4, 2013
Messages
806
Within the plex docker, I'm needing the plex GID to be 1001 to match previous permissions of my media library.

I see here that there is a PLEX_GID parameter: https://github.com/plexinc/pms-docker

However, I'm not quite sure how to utilize that properly? If I add it as an "Environment Variable" either on first install or after installation it results in an error.

Bottom line question: How can I change the plex group ID?

Thank you!
 

mroptman

Dabbler
Joined
Dec 2, 2019
Messages
23
You did not specify how you're running Plex - via SCALE apps or via compose on the CLI. The container features in the UI still are not that flushed out yet.

Per the README you linked, the PLEX_GID parameter is only taken on first start. So you'd need to backup your existing volume by copying the contents elsewhere, then delete the volume, and specify the correct value in your compose file. Starting via compose would create a new volume and pickup the GID value. Then copy over the old contents and the new volume should hopefully, pick up the new GID. You may have to build a new image from pms-docker and install chown/usermod tooling if those are needed to fix perms in the new volume. You could go back to pms-docker after volume permissions are working again.

If you are using SCALE apps, I don't believe these properties are exposed to set via the UI, so my experience here is quite limited.

Finally, I have only tested Plex as a VM within SCALE and it works flawlessly. A full VM environment is (in my opinion) easier to manage all of the Plex bits. (cron, nfs mounts, UID/GID, tautulli, omni etc).
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
In case you wondered: for the TrueCharts Plex App you can set k8s securityContext, we do not use the official docker image because it has flaws where k8s is concerned.
 

indivision

Guru
Joined
Jan 4, 2013
Messages
806
You did not specify how you're running Plex - via SCALE apps or via compose on the CLI. The container features in the UI still are not that flushed out yet.

My apologies. I am trying Plex via SCALE apps.

Per the README you linked, the PLEX_GID parameter is only taken on first start. So you'd need to backup your existing volume by copying the contents elsewhere, then delete the volume, and specify the correct value in your compose file. Starting via compose would create a new volume and pickup the GID value. Then copy over the old contents and the new volume should hopefully, pick up the new GID. You may have to build a new image from pms-docker and install chown/usermod tooling if those are needed to fix perms in the new volume. You could go back to pms-docker after volume permissions are working again.

Thank you. I only understand the high level concept of docker (ie. images that can be installed with some parameter adjustments). References to "compose", "volume" (what volume?), building a new image are new to me.

I'll get there eventually. But, I have a feeling that I'm not alone among many long-time FreeNAS users who have been using jails, etc.

It sounds like I would basically have to reconstruct a custom docker just to change the plex user GID? If so, I think I will just re-arrange my user credentials so that it matches the plex user. A bit tedious. But, seems less work than making a new image.

In case you wondered: for the TrueCharts Plex App you can set k8s securityContext, we do not use the official docker image because it has flaws where k8s is concerned.

Thank you. I feel like there needs to be a docker glossary. I am sold on the value of docker. But, discussions about it, even in "for dumby" and "how to" threads seems unusually byzantine. It's not difficult to find the home pages for these platforms. But, they tend to start technically deep for someone just looking to install an app.

Not trying to say anyone has done anything wrong. Hoping to make a constructive point from a user perspective.
 

paradoxiom

Patron
Joined
Jun 16, 2015
Messages
239
How did you end up making your own docker to chang ethe gid, if you did that? it's hard to find out what the heck to do because docker on truenas doesn't seem the same as docker everywhere else I guess?
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947
Why not just change the permissions on the media to the new Plex GID?
 

paradoxiom

Patron
Joined
Jun 16, 2015
Messages
239
Why not just change the permissions on the media to the new Plex GID?
Because the reason why I run everything as root wheel on core is because I was sick of the headache between everything, and it's just media data and nobody's going to hack me so, yeah.

I just reinstalled core because I'd rather the devil I know.
 

indivision

Guru
Joined
Jan 4, 2013
Messages
806
How did you end up making your own docker to chang ethe gid, if you did that? it's hard to find out what the heck to do because docker on truenas doesn't seem the same as docker everywhere else I guess?
I might not be the best person to ask. There could be a more informed way to set things up than what I've done.

It's been a while since I worked on this. From memory, I believe my solution was to create the group with GID I needed within the TrueNAS Plex installation. Then add the "plex" user to that group. I did this via the shell rather than through the parameter system.

It's probably worth noting here that most dockers I've seen (maybe all of the TrueCharts ones?) do have a parameter for this called "fsGroup". So, it's normally pretty easy to quickly make this change without going into shell, etc. For whatever reason, the Plex docker maintained by iX doesn't have that parameter up front.

Why not just change the permissions on the media to the new Plex GID?

There could be a good solution that solves this in a different way than I have. But, the reason for not changing the media permissions to match plex is that multiple other applications also need to access and update those files and they all use different user/group id by default.
 

indivision

Guru
Joined
Jan 4, 2013
Messages
806
Because the reason why I run everything as root wheel on core is because I was sick of the headache between everything, and it's just media data and nobody's going to hack me so, yeah.

I just reinstalled core because I'd rather the devil I know.

Hm. I feel the pain of learning something new. But, I'm very happy with Scale, despite the differences. I feel like the apps are a big upgrade there.
 

paradoxiom

Patron
Joined
Jun 16, 2015
Messages
239
I did like how much faster it seemed, and I'm sure once you learn it, it's only as painful as jails, but I've just got so many other projects going on right now and I just wanna watch some TV y'know?

The main issue I had is that I literally couldn't find any good step-by-step guides on how to simply setup a plex docker manually. It would say like, "do this", but not how to do that, so then you'd have to go down a rabbit hole figuring out how you do this on simple step, and it just snowballs like that.
Also I can't be sure but I think most docker resources online are for other things and truenas does them a bit differently or something? Because I kept seeing a lot of stuff that didn't seem to apply to me because it was for other systems.
 

indivision

Guru
Joined
Jan 4, 2013
Messages
806
I did like how much faster it seemed, and I'm sure once you learn it, it's only as painful as jails, but I've just got so many other projects going on right now and I just wanna watch some TV y'know?

Hah. Understandable. Probably why the cable companies can still sell TV subscriptions!

The main issue I had is that I literally couldn't find any good step-by-step guides on how to simply setup a plex docker manually. It would say like, "do this", but not how to do that, so then you'd have to go down a rabbit hole figuring out how you do this on simple step, and it just snowballs like that.
Also I can't be sure but I think most docker resources online are for other things and truenas does them a bit differently or something? Because I kept seeing a lot of stuff that didn't seem to apply to me because it was for other systems.

Yeah. I haven't explored making dockers myself. It does seem like there are probably some added steps needed to do that within the TrueNAS environment. If you were making dockers within Ubuntu there are probably many step-by-steps.

I just rely on others to make and maintain those and once I learned the install process, traefik and a few other nuances it has been pretty easy and stable. And new applications are being added often. So, it has opened up a lot of new uses for the server. When I'm not watching TV, I'd like for it to have something else to do! ;)
 
Top