6
2

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.

Docker image 一覧を容量順でソートする

Last updated at Posted at 2019-07-26

docker imagesdocker image ls の出力をイメージサイズ順で並び替える方法です。

docker images --format "table {{.Size}}\t{{.Repository}}:{{.Tag}}\t{{.ID}}" | sed -e '1d' | sort -h -r

上記のコマンドを実行すると以下のような出力が得られます。

1.83GB              codelibs/fess:13.2                             eb10fdc61ad9
814MB               golang:1.12.7-buster                           be63d15101cb
757MB               golang:1.11.10                                 69a024a6ecf5
350MB               golang:1.12.5-alpine                           c7330979841b
102MB               ubuntu:18.04                                   d131e0fa2585
87MB                python:3.7-alpine3.9                           cd2b35632442
79.1MB              python:3.6-alpine3.9                           f5522c1c3739
71MB                node:10.15.3-alpine                            d7c77d094be1
69.2MB              debian:10-slim                                 83ed3c583403
55.3MB              debian:9-slim                                  92d2f0789514
5.53MB              alpine:3.9                                     055936d39205

sort -h (--human-numeric-sort) により GB, MB 表記のままでもソートできます。

6
2
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
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?