15
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerfileで`apt-get upgrade`をつかってはいけない。注:古い日本語版だと誤訳されています。

Last updated at Posted at 2019-04-02

今までBest practices for writing dockerfilesを読んだつもりで全然読んでませんでしたすみません。

自分のブログからの転載です。

Best Practice

  • RUN apt-get upgradeを使わない。
  • 必須パッケージが古いことがわかっている場合は、ベースイメージのメンテナーに連絡した上で、RUN apt-get update && apt-get install -f hogeを利用する。
  • 日本語翻訳では、"Avoid RUN apt-get upgrade"が"Run apt-get update"を利用しない"と誤訳されている。

経緯

Dockerfile用のLinterを作っている友達がいて、その中にDo not use apt-get upgrade or dist-upgrade.というのがあり疑問に思って、調べてみたらこの情報を見つけました。

Best practices for writing dockerfiles読んだつもりで全然読めてませんでした。すみません。

理由

  • 「必須」パッケージを"unprivileged container"(訳が難しいが親イメージに対する「最下流の」コンテナ、的な意味)でアップデートするべきではないから。
    • ちゃんとベースイメージでアップデートするように求められています。

まとめ

  • RUN sudo apt-get upgradeを使う状況を作らない。
  • Bestpractices for writing dockerfilesをちゃんと読もう。
  • PR投げようかと思ったら、新しいのでは修正済みでした。Google検索だと1.9の情報が出てくるので注意。
15
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?