Add uid and gid as Docker environment variables#396
Add uid and gid as Docker environment variables#396platipo wants to merge 2 commits intoOperationCode:mainfrom platipo:dotenv-uid
Conversation
|
Hi @aaron-suarez, I added the dotenv orb an it seems working. Do you have any feedback? Maybe using a variable for the group id is an overkill, what do you think? |
|
Why is it 1000 sometimes and 5000 other times? Its not a problem I just don't understand what difference it makes |
|
I wasn't sure if all was correct so I chose to set the environment default values to a different number if it had raised an error I would have confirmed that the variables weren't propagating correctly. |
|
I can just set them all to 5000 if you want. Also do you want me to keep also the |
|
It's fine how it is if you just want to leave it. If you feel like removing the gid, you can as long as it still works |
|
I'm ok with all the changes, do you prefer that Dockerfile default variables are 5000? |
|
It's fine how it is. I'm mobile right now but when I get the chance to run it and make sure everything works, I'll approve and merge if nothing is broken. Thanks for this! |
|
Hi @aaron-suarez, did you manage to try the changes? |
|
|
||
| RUN useradd --no-create-home --system -s /bin/false --uid 5000 uwsgi | ||
| RUN groupadd --gid $GID uwsgi \ | ||
| && useradd --no-create-home --system -s /bin/false --uid $UID --gid $GID uwsgi |
There was a problem hiding this comment.
When you exec into the container, it's a little weird not having a name. Maybe we should give it one?
$ docker exec -it a536b7b91577 /bin/bash
I have no name!@a536b7b91577:/src$ whoami
whoami: cannot find name for user ID 5000
I have no name!@a536b7b91577:/src$
There was a problem hiding this comment.
I'm very consufed by the missing name because both the uwsgi is specified as group and user name and in the container I just built the container and this is the output:
platipo:~/resources_api $ sudo docker run -p80:5000 -it --rm resources_api/uwsgi /bin/bash
uwsgi@e26da29e625a:/src$ whoami
uwsgi
There was a problem hiding this comment.
I ran my container with make run, I wonder if that has something to do with it?
There was a problem hiding this comment.
It does docker-compose run -p 5000:5000 resources-api flask run -h 0.0.0.0. If you do that, do you also find that you're missing the user?
Line 58 in 34e7f70
There was a problem hiding this comment.
I tried some solutions, but I have no clue how to solve this 😢
There was a problem hiding this comment.
Ok when I have some time I'll see if I can solve it. Maybe it's worth merging and opening that as a separate issue... I'll want to give it one more good review before I determine that. Thanks for your patience on this
Reference: #388 (comment)