-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add uid and gid as Docker environment variables #396
base: main
Are you sure you want to change the base?
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? |
@@ -23,7 +25,8 @@ RUN poetry install --no-dev --no-interaction --no-ansi | |||
|
|||
COPY . /src | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran my container with make run
, I wonder if that has something to do with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
${DOCKER_COMPOSE} run -p 5000:5000 ${RESOURCES_CONTAINER} ${FLASK} run -h 0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried some solutions, but I have no clue how to solve this 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)