nodejs / nodejs/docker-node

Add --no-log-init to the node user that gets created to avoid massive image sizes

未关闭 适合新手
#1,779 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Dockerfile
星标
8.6k
派生
2k
平均合并
10 小时 19 分钟
30 天内合并 PR
16

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

搜索 Docker 镜像构建定义中创建 node 用户的所有 useradd 命令,从 issue 中显示的命令开始。为每个适用的命令添加所请求的选项,然后构建受影响的镜像,并检查报告的 Hadolint 警告是否已解决。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, dockerfile
领域
build-system, devops
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。