Self-hosted app updates are less likely to create root-owned files when the deployment pins a numeric user contract and validates volume ownership before replacing the container.
The preventive task is to stop treating the image’s internal username as a stable storage identity. Record the effective UID and GID that write persistent data, map them to host directories or named volumes, preserve any PUID/PGID or user-namespace settings, and test the new image against a small writable path before the full rollout. That way an image update cannot silently change the numeric owner of configuration, uploads, databases, or media metadata.
Record the Numeric UID and GID Before Updating
Capture the running process user, primary group, supplemental groups, and numeric ownership of representative files in every writable mount. Save the image digest or version beside that ownership baseline.
Docker’s image-building guidance says that explicit IDs avoid rebuild drift because automatically assigned image users can receive different numeric IDs across rebuilds.
Record numbers, not only names such as app or media. A new image can reuse the same username while changing its UID, and host files store numeric ownership.
Pin the Runtime User in the Deployment Contract
Where the image supports running directly as a non-root account, specify the intended user and group explicitly in Compose or the runtime configuration. If the image requires a root initialization phase, document which later process actually writes persistent data.
The Open Container image specification defines User as the runtime default, which means a changed image can alter runtime identity unless the deployment intentionally overrides or validates it.
Do not force an arbitrary non-root UID onto images that require a supported initialization model. The contract should follow the application’s documented design while keeping the resulting persistent-file owner predictable.
Keep PUID and PGID Aligned With Host Ownership
For images that expose PUID and PGID variables, pin those values in version-controlled Compose or environment configuration and ensure host-side volume directories are owned by the corresponding service account.
LinuxServer explains that PUID maps container writes so files created in mapped volumes remain manageable outside the container.
Before updating, compare the configured IDs with id on the host and with existing file ownership. Do not copy an example value such as 1000 blindly onto a server where that ID belongs to another person or service.
Account for User Namespaces and Rootless Mapping
Rootless Docker or Podman can make a process appear as root inside the container while mapping it to a non-root host UID. Record the namespace mode and subordinate UID/GID configuration before interpreting ownership changes.
Podman’s runtime options show that keep-id preserves user mapping when a container needs predictable access to host-mounted files.
Do not “fix” a root-looking owner inside the container until you inspect the host-side numeric ID. Namespaced root and host root are not always the same identity.
Preflight the New Image Against a Test Volume
Before replacing the production container, run the new image with the intended UID/GID and a temporary directory that mirrors the production permissions. Let startup initialization create one file and directory, then inspect their host-side ownership.
Red Hat’s rootless-volume debugging guide demonstrates that host ownership follows UID mapping rather than the username shown inside the container being sufficient evidence.
If the canary creates unexpected root-owned or remapped files, stop the rollout and compare image user, entrypoint, namespace, and mount settings. This is much safer than discovering the change after a recursive startup migration touches an entire photo or database tree.
Verify Supplemental Groups and Writable Paths
Some apps need a primary service UID plus access through a shared media, downloads, or device group. Record those group IDs and test all writable paths, not only the configuration directory.
Kubernetes uses explicit runAsUser and runAsGroup controls, illustrating the same Linux ownership principle even outside a simple Docker Compose deployment.
The update policy is complete when the new image creates files with the expected host ownership across every persistent path and survives one container recreation. The related ZimaSpace article on root-owned files after image updates is the recovery branch if a rollout has already produced root-owned data.
Support & Tips
More to Read

Can Plex Share a GPU With Another Docker Container?
Plex and another container can often access the same GPU, but you must test driver support, device mapping, video-engine load, memory, and recovery behavior.

How to Tell Whether a Plex Error Comes From the Client or Server
Reproduce the same item on another client, compare the session path, then collect server evidence only after scope tells you where the failure actually...

How to Configure Plex Cache and Transcode Temporary Storage
Protect persistent Plex state while placing transcode temp files on suitable local storage, then verify cleanup, free space, and restart behavior.

