Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Improve entrypoint script #1545

Closed
ToXinE opened this issue Sep 23, 2021 · 12 comments
Closed

Docker: Improve entrypoint script #1545

ToXinE opened this issue Sep 23, 2021 · 12 comments
Assignees
Labels
enhancement Optimization, improvement or maintenance task released Available in the stable release

Comments

@ToXinE
Copy link

ToXinE commented Sep 23, 2021

As i've saw in issue #263 I think there is a bug in setting the correct GID of photoprism with docker compose.

here is my docker-compose.yml

I've set UID to 1000 (mediacenter) and gid to 1000 (mediacenter) in docker compose but it creates the directory photoprism with 1000:0 and the other with another user.

here is the problem :
image

Latest photoprism docker image running on Ubuntu 20.04 LTS

How can i make the docker image to use my user "mediacenter" and the group "mediacenter" ?

@lastzero
Copy link
Member

Did you try starting PhotoPrism with user: "1000:1000" in your docker-compose.yml?

The env variables are for NAS devices who don't support setting a user / group natively. Of course we're also welcome improvements for the related entrypoint.sh script. 👍

@ToXinE
Copy link
Author

ToXinE commented Sep 24, 2021

Yes I tried but it seems no to do anything.
I don't care running as photoprism:photoprism inside the container, I only need to map the user used inside the container to mediacenter:mediacenter outside of the container. I thought the parameters UID, GID and UMASK was made for that purpose. Am I right or did I miss something ?

@lastzero
Copy link
Member

It's made for this, but i can't confirm any issues just like I don't have issues with the native user parameter. Might be something else if both don't work for you?

@stumpylog
Copy link

I belive I'm running into this as well. When starting the docker container, I see the following in the logs:

groupadd: '971' is not a valid group name
usermod: group '971' does not exist

As with the above example, I am setting a UID and GID through environment variables. It appears the group isn't being created?

@lastzero
Copy link
Member

lastzero commented Sep 27, 2021

Can you check our entrypoint script and suggest how we can improve this for you so that it works?

@ToXinE
Copy link
Author

ToXinE commented Sep 28, 2021

I'd like to but I'm not expert enough in docker / containers to know what's wrong with GID not being applied.
I've set GID to my mediacenter group Id but it doesn't care and run photoprim with root group (0) instead of mediacenter group (1000) as specified in the GID environnement variable.

      # Set a non-root user, group, or custom umask if your Docker environment doesn't support this natively:
      UID: 1000
      GID: 1000
      UMASK: 002

@lastzero
Copy link
Member

Might have to simply create that group in the container...

@lastzero
Copy link
Member

Our use the native Docker way to set user and group

@lastzero lastzero self-assigned this Sep 28, 2021
@lastzero lastzero added the enhancement Optimization, improvement or maintenance task label Sep 28, 2021
@lastzero lastzero added the in-progress Somebody is working on this label Sep 28, 2021
@lastzero lastzero changed the title Specify GID of photoprism user in Docker Docker: Improve entrypoint script Sep 28, 2021
@lastzero lastzero added please-test Ready for acceptance test and removed in-progress Somebody is working on this labels Sep 28, 2021
@lastzero
Copy link
Member

lastzero commented Sep 28, 2021

Started a new Development Preview build with the improved entrypoint script (available when the build is green): https://drone.photoprism.app/photoprism/photoprism/1902/1/5

Note that we've added PHOTOPRISM_ prefixes to the environment variable names:

  • Instead of UID, please now use PHOTOPRISM_UID
  • Instead of GID, please now use PHOTOPRISM_GID
  • Instead of UMASK, please now use PHOTOPRISM_UMASK

Let us know if this works for you!

@lastzero
Copy link
Member

@ToXinE Did you already try a simple

chown -R mediacenter:mediacenter ~/photoprism_storage

or does Docker automatically change the group back to root?

@ToXinE
Copy link
Author

ToXinE commented Sep 28, 2021

I'll try asap thank you !

@lastzero
Copy link
Member

lastzero commented Oct 2, 2021

Released! 🥂

Make sure to prefix existing environment variables with PHOTOPRISM_ as described above.

@lastzero lastzero closed this as completed Oct 2, 2021
@lastzero lastzero added released Available in the stable release and removed please-test Ready for acceptance test labels Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Optimization, improvement or maintenance task released Available in the stable release
Projects
Status: Release 🌈
Development

No branches or pull requests

3 participants