Add --no-log-init to the node user that gets created to avoid massive image sizes
Nobody has claimed this yet.
- Dominant language
- Dockerfile
- Stars
- 8.6k
- Forks
- 2k
- Avg merge
- 10h 19m
- Merged PRs (30d)
- 16
Description
Problem
Currently the node user is created with useradd --uid 1000 --gid node --shell /bin/bash --create-home node.
When customizing the UID / GID using build args with groupmod -g "${GID}" node && usermod -u "${UID}" -g "${GID}" node, some folks are reporting they are running out of disk space and can't build the image when they have a non-1000 UID on systems that create a lot of users.
Here's a comment going into more detail: https://github.com/nickjj/docker-flask-example/pull/7#issuecomment-1266698181
Also not using --no-log-init will cause Hadolint to throw this warning: -:44 DL3046 warning: useradd without flag -l and high UID will result in excessively large Image.
The usermod command doesn't support being able to set that option so it means our only option is to delete the node user and create a new one in which case life could be simplified by setting that flag here. You could make a case this is a bug report and not feature request due to the implications of not setting this flag when you create users in a Docker image.
Solution
Add --no-log-init to all of the useradd commands that create the node user.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the Docker image build definitions for every useradd command that creates the node user, starting with the command shown in the issue. Add the requested option to each applicable command, then build the affected images and check that the reported Hadolint warning is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, dockerfile
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100