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

オープン 初心者向け
#1,779 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
docker, dockerfile

調査の方向性

Docker イメージのビルド定義を検索し、issue に示されているコマンドから始めて、node ユーザーを作成するすべての useradd コマンドを見つけます。該当する各コマンドに要求されたオプションを追加し、その後、影響を受けるイメージをビルドして、報告された Hadolint の警告が解消されていることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Dockerfile
スター
8.6k
フォーク
2k
平均マージ
10時間 19分
マージ済み PR(30日)
16

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/docker-node のほかの issue

nodejs/docker-node の issue をすべて見る

似ている issue

Build System の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。