Add --no-log-init to the node user that gets created to avoid massive image sizes
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Dockerfile
- Estrellas
- 8.6k
- Forks
- 2k
- Merge medio
- 10 h 19 min
- PR fusionados (30 d)
- 16
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Busca en las definiciones de compilación de las imágenes de Docker todos los comandos useradd que crean el usuario node, empezando por el comando mostrado en el issue. Añade la opción solicitada a cada comando aplicable, luego compila las imágenes afectadas y comprueba que la advertencia de Hadolint indicada se haya resuelto.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, dockerfile
- Área
- build-system, devops
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Tranquilo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 68/100