0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

dockerコマンド逆引き

0
Posted at

導入

毎回調べるので、個人的に使うdockerコマンドを備考として。

image

リスト表示

docker image ls | (read header; echo "$header"; sort -k1,1 -k2,2V)

  • 概要
    REPOSITORY / TAG の降順にソートして表示するコマンド
    ※通常は CREATED の新しい順に表示される

  • 内容

    • read header; echo "$header"; でヘッダ行をソート対象外にする
    • sort -k1,1 -k2,2 で 1カラム目(REPOSITORY) -> 2カラム目(TAG) の優先順位でソート
  • 注意

    • Macなど sort が -V オプションに対応していない場合は以下のコマンドで代用
      • docker image ls | (read header; echo "$header"; sort -k1,1 -k2,2)
        ※ -V を使っていないので文字列としてソートしている点に留意

dangling image の削除

docker image prune

  • 概要
    • dangling image (タグが外れてどこからも参照されていないイメージ) を一括削除する
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?