Add linuxserver-style PUID and PGID support to the PhotoStructure docker image

I’m adding this feature request to gauge interest in improving user: support for docker users: https://photostructure.com/server/photostructure-for-docker/#library-ownership. This approach uses the --user option alongside userns-remap, which is kind of a PITA.

PhotoStructure doesn’t have any user-specific code in the Dockerfile or image to support users, but Linuxserver docker images typically include this init file which makes the process run as any arbitrary uid and gid.

Please vote for this if you’d rather have PUID/PGID support, instead of using docker’s --user feature.

userns is an advanced feature, which cannot be enabled for just a single container and on some systems (e.g. Synology) changing the docker configuration is not exactly supported. Therefore, I’d prefer not needing to set this up.

I’ve just added this to the next build :tada:

Documentation is here: https://phstr.com/go/puid

Note that if you’ve been running PhotoStructure as root and then you upgrade, file permissions are likely such that the new custom userid/groupid won’t be able to read and write to the settings and .photostructure library contents. So, before you upgrade:

  1. Shut down PhotoStructure

  2. chown -R $PUID:$PGID the /ps/config, /ps/library, /ps/logs, and /ps/tmp bind mount source directories

  3. Edit your docker-compose.yml to pull from the new :beta tag

  4. Add lines to the environment: section:

    environment:
      - "PUID:1234"
      - "PGID:1234"
    

    (replace 1234 with the userid/groupid you want to run PhotoStructure as)

  5. Make sure you delete any existing user: directive in your docker-compose. We’re not using that feature in docker here.

  6. docker-compose pull && docker-compose up --detach

2 Likes