fix(docker): Remove existing docker user when UID or GIG already exists in the image#29
Open
arntanguy wants to merge 1 commit intofrankarobotics:mainfrom
Open
fix(docker): Remove existing docker user when UID or GIG already exists in the image#29arntanguy wants to merge 1 commit intofrankarobotics:mainfrom
arntanguy wants to merge 1 commit intofrankarobotics:mainfrom
Conversation
|
|
||
| # Delete existing group if it exists | ||
| RUN if getent group ${USER_GID}; then \ | ||
| groupdel $(getent group ${USER_GID} | cut -d: -f1); \ |
Contributor
There was a problem hiding this comment.
What does this exactly do?
Author
There was a problem hiding this comment.
The first checks if there is an existing group for the provided USER_GID in the docker image:
❯ getent group 100;
users:x:100:
The second gets the group name:
❯ getent group 100 | cut -d: -f1
users
and deletes it from the docker image.
This is to ensure that when creating our own user/group in the following command it'll work regardless of whether the user's UID/GID matches with existing users in the base docker image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28