Skip to content

Improved the container user creation process#10

Open
john-r-graham wants to merge 1 commit into
nxp-imx:masterfrom
john-r-graham:user-create-bug-fix
Open

Improved the container user creation process#10
john-r-graham wants to merge 1 commit into
nxp-imx:masterfrom
john-r-graham:user-create-bug-fix

Conversation

@john-r-graham

Copy link
Copy Markdown

This accounts for the condition where the UID and/or GID of the host system user already exists in the container. This was causing the docker build to fail late in the process, not quite completing the container build.

A new create-container-user.sh script has a slightly more nuanced user creation heuristic that creates the new host user/group if there is no UID/GID overlap and modifies the existing user/group if there is. The script is shared with all dockerfiles and frankly looks a lot nicer than it would if it was included in each with all those line continuation escapes and semicolons.

This accounts for the condition where the UID and/or GID of the host system user
already exists in the container. This was causing the `docker build` to fail
late in the process, not _quite_ completing the container build.

A new `create-container-user.sh` script has a slightly more nuanced user
creation heuristic that _creates_ the new host user/group if there is no
UID/GID overlap and _modifies_ the existing user/group if there _is._ The script
is shared with _all_ dockerfiles and frankly looks a lot nicer than it would if
it was included in each with all those line continuation escapes and semicolons.
@dmathew-pm

Copy link
Copy Markdown

An easy fix is to add these lines just below the FROM line in the Dockerfile:
RUN touch /var/mail/ubuntu
&& chown ubuntu /var/mail/ubuntu
&& userdel -r ubuntu

Inspiration: https://gitlab.com/crafty-controller/crafty-4/-/work_items/521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants