如何显示当前主机上,docker占用的空间情况?


docker占用主机磁盘资源了? 查查看,到底是docker占用了哪些资源?

 

命令非常的简单

 

docker system df

 

 

 

说说每个字段的意思:

 

Images:

  • TOTAL 当前环境,一共有多少个镜像(去除镜像ID相同的)
  • ACTIVE 实际上被使用的镜像数量
  • RECLAIMABLE,没有被使用的镜像,占用的空间,删除后,可释放空间。

 

Containers

  • TOTAL ,docker ps -a看到的总共的容器数
  • ACTIVE,docker ps 看到的实际在运行的容器数量
  • RECLAIMABLE,docker ps -a 状态为Exited状态的容器占用的空间,删除后,可释放的空间。

 

那更加详细的看的话,命令也非常的简单

 

docker system df -v

 

 

输出结果像这样

 

[root@nctest-snap-test-02 ~]# docker system df -v
Images space usage:

REPOSITORY                                                TAG                      IMAGE ID            CREATED             SIZE                SHARED SIZE         UNIQUE SIZE         CONTAINERS
<none>                                                    <none>                   e329d879d43c        4 months ago        449.6MB             449.6MB             0B                  0
nginx                                                     1.13-alpine              ad88d01dbfae        4 months ago        309.8MB             108.3MB             201.5MB             0
172.20.58.152/python/python                               3.10.4                   73381281305e        4 months ago        919.4MB             0B                  919.4MB             1
nextcloud                                                 latest                   84ae277ac573        4 months ago        955.5MB             0B                  955.5MB             1
172.20.58.152/database/mysql                              5.7.37                   f26e21ddd20d        4 months ago        449.6MB             449.6MB             0B                  0
172.20.58.152/database/mysql                              8.0.28                   667ee8fb158e        4 months ago        520.7MB             136.6MB             384.1MB             1
172.20.58.152/database/mariadb                            10.7.3                   6e0162b44a5f        5 months ago        414.1MB             0B                  414.1MB             0
172.20.58.152/kubernetes/calico/typha                     v3.21.4                  c1ea2825a933        7 months ago        127.4MB             0B                  127.4MB             0
172.20.58.152/kubernetes/calico/cni                       v3.21.4                  f1de15d70851        7 months ago        235.5MB             0B                  235.5MB             0
172.20.58.152/kubernetes/calico/node                      v3.21.4                  c59896fc7ca4        7 months ago        211.9MB             0B                  211.9MB             0
172.20.58.152/middleware/gitlab-ce                        latest                   46cd6954564a        7 months ago        2.364GB             72.78MB             2.291GB             1
pinpointdocker/pinpoint-hbase                             2.3.3                    c40d61241356        7 months ago        1.093GB             0B                  1.093GB             1
pinpointdocker/pinpoint-mysql                             2.3.3                    dce1f13614a3        7 months ago        468MB               0B                  468MB               1
pinpointdocker/pinpoint-flink                             2.3.3                    78d25986e364        7 months ago        626.4MB             0B                  626.4MB             2
pinpointdocker/pinpoint-collector                         2.3.3                    798fe5b30833        7 months ago        197.3MB             104.8MB             92.47MB             1
pinpointdocker/pinpoint-agent                             2.3.3                    05ade5accf8c        7 months ago        39.5MB              0B                  39.5MB              1
pinpointdocker/pinpoint-quickstart                        latest                   73a25a6148ae        7 months ago        309.4MB             0B                  309.4MB             1
pinpointdocker/pinpoint-web                               2.3.3                    71972a41e758        7 months ago        221.5MB             104.8MB             116.7MB             1
gotok8s/kube-apiserver                                    v1.23.1                  b6d7abedde39        8 months ago        135.2MB             3.869MB             131.3MB             0
172.20.58.152/kubernetes/kube-proxy-amd64                 v1.23.1                  b46c42588d51        8 months ago        112.3MB             0B                  112.3MB             0
172.20.58.152/kubernetes/kube-scheduler-amd64             v1.23.1                  71d575efe628        8 months ago        53.49MB             3.869MB             49.62MB             0
172.20.58.152/kubernetes/kube-controller-manager-amd64    v1.23.1                  f51846a4fd28        8 months ago        125MB               3.869MB             121.1MB             0
rabbitmq                                                  latest                   d445c0adc9a5        8 months ago        220.2MB             75.25MB             144.9MB             0
172.20.58.152/database/mongo                              5.0.5                    dfda7a2cf273        8 months ago        692.6MB             72.78MB             619.9MB             1
<none>                                                    <none>                   9a8e1ec1235e        8 months ago        309.2MB             108.3MB             200.9MB             0
172.20.58.152/middleware/rabbitmq                         3.9                      c10b0f4fd126        8 months ago        219.9MB             75.25MB             144.7MB             0
redis                                                     6.2.6                    40c68ed3a4d2        9 months ago        112.7MB             0B                  112.7MB             0
postgres                                                  9                        7a6817286183        9 months ago        199.8MB             0B                  199.8MB             0
172.20.58.152/middleware/mysql                            8.0.27                   b05128b000dd        9 months ago        515.6MB             0B                  515.6MB             0
tomcat                                                    9.0.53-jdk8u202-alpine   276e0060c50a        9 months ago        509.2MB             5.624MB             503.6MB             0
172.20.58.152/middleware/consul                           latest                   60b5d5d7aa05        9 months ago        117.8MB             5.624MB             112.2MB             1
quay.io/coreos/flannel                                    v0.15.1-amd64            e6ea68648f0c        9 months ago        69.52MB             5.624MB             63.89MB             0
alpine                                                    3.13                     6b7b3256dabe        9 months ago        5.624MB             5.624MB             0B                  5
prom/prometheus                                           latest                   c10e9cbf22cd        9 months ago        194.1MB             0B                  194.1MB             0
172.20.58.152/kubernetes/coredns                          v1.8.6                   a4ca41631cc7        10 months ago       46.83MB             0B                  46.83MB             0
kubeoperator/webkubectl                                   latest                   61cd0f320949        11 months ago       239.2MB             0B                  239.2MB             1
zookeeper                                                 3.4                      4b03fe5b3f64        15 months ago       259.7MB             0B                  259.7MB             3
goharbor/chartmuseum-photon                               v1.10.3                  f4cd7df55b4a        2 years ago         177.6MB             33.7MB              143.9MB             0
goharbor/harbor-migrator                                  v1.10.3                  524036d275a6        2 years ago         357MB               33.7MB              323.3MB             0
goharbor/redis-photon                                     v1.10.3                  6562f3c58b71        2 years ago         118.6MB             33.7MB              84.9MB              1
goharbor/clair-photon                                     v1.10.3                  3c0b186089bd        2 years ago         170.7MB             33.7MB              137MB               0
goharbor/notary-server-photon                             v1.10.3                  d0f003ba5021        2 years ago         142.8MB             33.7MB              109.1MB             0
goharbor/harbor-registryctl                               v1.10.3                  2ee885ed2f2d        2 years ago         101.8MB             33.7MB              68.09MB             1
goharbor/registry-photon                                  v1.10.3                  f470058ab661        2 years ago         84.47MB             33.7MB              50.78MB             1
goharbor/nginx-photon                                     v1.10.3                  8c88b468cdb0        2 years ago         43.6MB              33.7MB              9.902MB             1
goharbor/harbor-log                                       v1.10.3                  b0c9e48d015e        2 years ago         82.01MB             33.7MB              48.31MB             1
goharbor/harbor-jobservice                                v1.10.3                  044b1a98e9ac        2 years ago         143MB               33.7MB              109.3MB             1
goharbor/harbor-core                                      v1.10.3                  6521cd80151b        2 years ago         129.3MB             33.7MB              95.64MB             1
goharbor/harbor-portal                                    v1.10.3                  7d107a7d6eb8        2 years ago         51.7MB              33.7MB              18.01MB             1
goharbor/harbor-db                                        v1.10.3                  7d10c16f9b2e        2 years ago         156.8MB             33.7MB              123.1MB             1
goharbor/prepare                                          v1.10.3                  be46b57a9105        2 years ago         162.9MB             33.7MB              129.2MB             0
reg.yyuap.io/c87e2267-1001-4c70-bb2a-ab41f3b81aa3/am-fa   20200522203451           5445d67547a7        2 years ago         930.3MB             0B                  930.3MB             1
172.20.58.152/tools/polinux/stress                        latest                   df58d15b053d        2 years ago         9.744MB             0B                  9.744MB             0
nginx                                                     1.13.5                   1e5ab59102ce        4 years ago         108.3MB             108.3MB             0B                  0

Containers space usage:

CONTAINER ID        IMAGE                                                                    COMMAND                  LOCAL VOLUMES       SIZE                CREATED             STATUS                      NAMES
da46f3e08edf        6b7b3256dabe                                                             "sh"                     0                   22B                 6 weeks ago         Exited (0) 6 weeks ago      xenodochial_tereshkova
b835bb0b8470        6b7b3256dabe                                                             "sh"                     0                   14B                 6 weeks ago         Exited (0) 6 weeks ago      dazzling_panini
34179402e26f        6b7b3256dabe                                                             "sh"                     0                   14B                 6 weeks ago         Exited (0) 6 weeks ago      awesome_shaw
4fb39d4a5650        6b7b3256dabe                                                             "sh"                     0                   56B                 6 weeks ago         Exited (0) 6 weeks ago      funny_liskov
2a5c2b122f29        alpine:3.13                                                              "/bin/sh"                0                   0B                  7 weeks ago         Exited (0) 7 weeks ago      thirsty_curie
c8e146a19d1c        reg.yyuap.io/c87e2267-1001-4c70-bb2a-ab41f3b81aa3/am-fa:20200522203451   "/usr/bin/dumb-init …"   0                   152B                2 months ago        Exited (129) 8 weeks ago    peaceful_morse
77b98cdbd1f1        pinpointdocker/pinpoint-quickstart                                       "catalina.sh run"        1                   7.11kB              4 months ago        Exited (143) 4 months ago   pinpoint-quickstart
aef1c390043d        pinpointdocker/pinpoint-agent:2.3.3                                      "/usr/local/bin/conf…"   1                   0B                  4 months ago        Exited (137) 4 months ago   pinpoint-agent
52c089188d8b        pinpointdocker/pinpoint-web:2.3.3                                        "sh /pinpoint/script…"   0                   1.21MB              4 months ago        Exited (143) 4 months ago   pinpoint-web
0cd48a61a095        pinpointdocker/pinpoint-collector:2.3.3                                  "sh /pinpoint/script…"   0                   1.35MB              4 months ago        Exited (143) 4 months ago   pinpoint-collector
e2f461c6b044        pinpointdocker/pinpoint-flink:2.3.3                                      "/docker-bin/docker-…"   0                   9.84kB              4 months ago        Exited (143) 4 months ago   pinpoint-flink-taskmanager
f5e19e684ec8        pinpointdocker/pinpoint-hbase:2.3.3                                      "/bin/sh -c '/usr/lo…"   2                   2.07MB              4 months ago        Exited (137) 4 months ago   pinpoint-hbase
60f5253169d5        pinpointdocker/pinpoint-flink:2.3.3                                      "/docker-bin/docker-…"   0                   90.7MB              4 months ago        Exited (137) 4 months ago   pinpoint-flink-jobmanager
0db5d4fe6c36        pinpointdocker/pinpoint-mysql:2.3.3                                      "docker-entrypoint.s…"   1                   80B                 4 months ago        Exited (0) 4 months ago     pinpoint-mysql
11373da3a578        zookeeper:3.4                                                            "/docker-entrypoint.…"   3                   3.85kB              4 months ago        Exited (143) 4 months ago   pinpoint-docker-master_zoo1_1
e0083cfd6950        zookeeper:3.4                                                            "/docker-entrypoint.…"   3                   3.85kB              4 months ago        Exited (143) 4 months ago   pinpoint-docker-master_zoo3_1
5380b31c936c        zookeeper:3.4                                                            "/docker-entrypoint.…"   3                   3.88kB              4 months ago        Exited (143) 4 months ago   pinpoint-docker-master_zoo2_1
db452fa3b29e        172.20.58.152/database/mysql:8.0.28                                      "docker-entrypoint.s…"   0                   0B                  4 months ago        Exited (0) 4 months ago     mysql-8.0.28
2e4fc9deeb1d        python:3.10.4                                                            "bash"                   0                   975kB               4 months ago        Exited (0) 4 months ago     busy_noyce
11fdb7cb576f        nextcloud                                                                "/entrypoint.sh apac…"   0                   1.38kB              4 months ago        Exited (0) 4 months ago     nextcloud
8b9cbb9f74fa        172.20.58.152/middleware/gitlab-ce:latest                                "/assets/wrapper"        0                   2.36MB              4 months ago        Exited (137) 4 months ago   gitlab-ce
eb692da20b3a        172.20.58.152/database/mongo:5.0.5                                       "docker-entrypoint.s…"   1                   509B                4 months ago        Exited (255) 4 months ago   mongodb
3ffc4d8da0e0        goharbor/nginx-photon:v1.10.3                                            "nginx -g 'daemon of…"   3                   2B                  4 months ago        Up 2 months (healthy)       nginx
d3afcbda17c5        goharbor/harbor-jobservice:v1.10.3                                       "/harbor/harbor_jobs…"   0                   0B                  4 months ago        Up 2 months (healthy)       harbor-jobservice
5924fe60c7a7        goharbor/harbor-core:v1.10.3                                             "/harbor/harbor_core"    0                   0B                  4 months ago        Up 2 months (healthy)       harbor-core
c6c86a7af5c5        goharbor/harbor-db:v1.10.3                                               "/docker-entrypoint.…"   0                   59B                 4 months ago        Up 2 months (healthy)       harbor-db
1ad5b2ac73dd        goharbor/harbor-registryctl:v1.10.3                                      "/home/harbor/start.…"   1                   1.64MB              4 months ago        Up 2 months (healthy)       registryctl
8d585ea4bb66        goharbor/redis-photon:v1.10.3                                            "redis-server /etc/r…"   0                   0B                  4 months ago        Up 2 months (healthy)       redis
807c386453ba        goharbor/registry-photon:v1.10.3                                         "/home/harbor/entryp…"   1                   1.64MB              4 months ago        Up 2 months (healthy)       registry
dbc12f040354        goharbor/harbor-portal:v1.10.3                                           "nginx -g 'daemon of…"   3                   2B                  4 months ago        Up 2 months (healthy)       harbor-portal
65bda89313e4        goharbor/harbor-log:v1.10.3                                              "/bin/sh -c /usr/loc…"   2                   492B                4 months ago        Up 2 months (healthy)       harbor-log
6f4d260a59df        consul                                                                   "docker-entrypoint.s…"   1                   36B                 5 months ago        Exited (1) 4 months ago     consul
ea1eab9f347b        kubeoperator/webkubectl                                                  "sh /opt/webkubectl/…"   0                   323B                6 months ago        Exited (137) 2 months ago   webkubectl

Local Volumes space usage:

VOLUME NAME                                                        LINKS               SIZE
748cda2a493f71049cebc91839f2118ada8f0cd3313b811674069e75b7c91063   0                   22B
bb6b5aad8d76aa768b89ba1e36fc71c2d6804ff355ac1cb1a8a2d7f41e1fc691   1                   22B
c0d7d2995bcc23383c019efc6f653f028fd397f9578273a65cdc5707c3866390   1                   67.11MB
3fab0aa992a89f5d7986a9ad559b005c9078c7d1991e242bef0ae6990ef27933   0                   0B
ebd4c50155c0db8cce88ff4254c7cfc3b4151f413804fd5afd60c6067acc7707   0                   4B
5efad55d4944e459c98133155a2e0eb88890af853d9c646cf36f1e05dc3e46c4   1                   0B
f457125bad2ab614b515c0281891948693e80617e5bdb02dafa75c9cb4092a76   0                   191.7MB
8b9cf33d6e414bdf660b7080563b2212a8c154d80f7f8db5b0f09da08eb6201b   0                   0B
e4d9ee8432e825dac6a43c19685f843cc379e9924ce83bcb2b560f1172256515   0                   3.057GB
pinpoint-docker-master_mysql_data                                  1                   208.9MB
494ef2bdd9f90a83ba1e204dab333d5722748463a64025e9b381ed3779120658   1                   300B
01b6a3a4ae4f78b49948384617a1500f46a39222cdb69b997dbad33d0d4bb148   0                   0B
20d8b04dc2c9f8ac84e906f66a97282981deb2048da4fb372ca6211457cee23d   0                   0B
873762fd68671a7ff17c17d998d05e7a929a17fbb0a2ccce44c705981d2d68ef   0                   22B
a75faca061538b72d5305adef50b77c031ac83af835c2f77b2ee63a5f9a4cb66   0                   140.7MB
ab09095854535d66b3be9548d07684e76159db1c7d554ba2db7d8f228a4af9c7   0                   0B
e220820b8eb9dfb4326bc3fb19e86f3c64a911c0a571e11b5a3a255565832c59   0                   315.1MB
f6ec74bd8f086eec852d69547a5e5b2366c7d394e3e4ed8367d7975b8321caaf   0                   4B
3234fe654fa6b0fd3ab0350e9f6ac9450dfcd06f4f2397bed76e6081300f6fa3   1                   67.11MB
2eaf39411106a30d4cfa5e0aae9275860b87a4d5a0ff7ceb6d51b2074ca944e7   0                   0B
445fb5500c5a71c51eafb4abb74870c2132138be59ecf34b8ac4a87f3751eda6   0                   0B
46e9cd943d737d06288b3cf0f360505902ee68cc9f06c92497d90f401aa73328   1                   0B
c6fa6574cea4dda7a84a11f2aae62791c57c74aa09d76aa408e63f6b6833357f   0                   772.8kB
ca1e3124a69e4ede52ce2139f2173105d9e580793a2ac40af6639814caeaa4f3   0                   69.67MB
e3807d78208591462148e8e62e11f2a930a6fbf5b3b3502db7db11f63f2c9713   1                   0B
a871b2d7e0af8fef22e152d8d8dbc664c3db4a041e1f0ef4fa1a009b11691ec4   1                   0B
8de6f48d24780dd6f784b065f582514bff75df770b3ff0b45b64aa4559e57856   0                   4B
8de91ac691df2335ba3f55866a096101d781d51ade9445206ec8173cf67ea738   0                   152.5kB
e2608f95c3dcb330196ccfb9e01cc2f3ffd594a28883b5a3d1e649de489c559d   0                   0B
2a3aa156416277e0b54a5c4995c922d4a7753ff9db9f4aceaed45d4e2a7effbf   1                   0B
517d20daee0ff407db15a7c0b03691945ac79e501ccc29c0e8cb332e98ea35d3   0                   314.8MB
53fe182f98fa877f4e8a596d4213c72905c33e13f0bc48dc0f4f35a3a167402e   0                   22B
6ac3fa39c685396310ee9c1da218679ec23db70d36427e9ea618806a36399b72   0                   0B
6ba39a2d1a535dd94af405f8bfa1dbc3850bfb7916dfc8887953bf5f6e385f51   0                   0B
pinpoint-docker-master_data-volume                                 2                   32.5MB
d60a91fe2ce1e8abcb0481e27fdae49b18f830a5dc6b53fb78a2a8acc03c2002   1                   0B
360c13a331d7ef13d9175f36c84cf4a9efe2e90004ddd6b28efadf9699f0f507   0                   0B
87e374d4c5e20b860f1d4c1c13ab2a7f92878bedc015fe3f3116ef11054b4b3c   0                   0B
anchore_anchore-db-volume                                          0                   691.2MB
ce5f7777c4774b447f2eec0ecb7ffbf8f683f3f03bb4733a23649c775515f3c1   0                   0B
727c5b3df537e25d7d2881119d7c78e4a3322f1b8728ef3bea7c4901f1cce88f   0                   0B
792b29a02390aa5d47743307b880efcd409c6b07d5b82795a3e14c4d34d27439   0                   0B
897f57f20c4a2e0d50013ef96c82a8342484c9248b2c5ba69c3c379cda5a87dd   0                   0B
b1ff6043a51f56a4055dc01b0e21b863ee2d8858f2dfca04e8a54dd047abf74c   0                   0B
2d9d7ff592b5e1b390fbafddd3a7e4f80ad5b519302070c91dad1e24dcbfee49   0                   0B
53b52d7ff16275106adeb0a4a6a6a3fb80a078f4b6e6ea7386253f02396b8d23   1                   36B
4f53b1742573d5e442047642bc4139b7dad637c384c41386835beda3f38e1064   1                   0B
7b5769045cccfb59de9301432220a4da86946774e70681ec85c640c393beb842   0                   152.5kB
91f4e9e97fc1bfc4516bb0da1721d0ffd59249cb2ef65312ebee32c5087ac03a   1                   0B
ed66ff4c1088c4f917d51d0a4507d6915b5c9466872862969eea477cc1f4d095   0                   0B
18b50d674749802b297713cbafcb0266486c1be5ff5e914dbde13d06999085d8   1                   4B
958a3cf5e169a7c7b0af08ed0999fd8e9ba20a537b6ba447f5cb525e5cf62447   1                   4B
e1033960ae7c14aca5ee4cfce0ab34a14d2bc0f7eb33b6d7f65c71aa314e74cc   0                   0B
1909eecd7d5dc8114c8b34a11ef992075430281a52e34faf01557bdb6f15f191   0                   0B
1f922b0bc26cf5d3c3e4d24e1fa2b90e5d6ee7c2c9bcff131466fabafb01ba52   1                   22B
34246b7cd55a1f7c9162b1fdbeb59d0f4c8e1550edd874f84ec4a0810eb862ec   0                   476B
49a53ee471bb0e2d480ed64e7b514c057101ad69d2a134fc462eab74533ac90e   0                   0B
5c4bd6d7fbdf4805e429c5b8a8d0b304dc1454157bdb9bc757f2c34d568719f3   1                   0B
664c9a8a9c71893180f79dc722a67699cee069073b4a88dcff506bf0f1c52de0   1                   0B
86fe4a2a7b22d64636e18f7a2059afb3773b6a0baf990a952e895e961b2896be   1                   0B
fea84acdc909f2f66f841e48865a41ec41dabfa5039505d203ba40f5ffe71f2e   0                   22B
2ca5bf1f048828aedbe50926b1becec24011726cbd9624c1484dafe602541624   1                   4B
494650fcf1def9df852060e9f547bd971ad4ac3627587831be81b495afb69218   0                   476B
5f60d097b2e6e5bd544642ee3a23b55eddcc3a2e338f09dfff29ed1edce600f1   0                   22B
2bf4b39c3f1e7d13b80610ceb8c6bb5692393f9542e78d2ef1431de118cca7de   1                   67.11MB
6868db7d9220591a2514706b890e19b9a20fe24313f4cbe8e31ef8aed6b2d6a5   0                   36B
331f024d252c799c3bac6779a39b6a6ace1b39b4656d68b1f1d4190c94b36a73   1                   1.142MB
fe7735e16a0cc92e8bf112d79fd2d69e341d27fb4d928c6aa63078647d4ade15   1                   0B
c3fb20d4e585a95de96c5cc559506d2ecc7bf3336e6ee9af43316f49ad42637b   0                   0B
e22391b97164fadf5971457768f1be953000016dbcac8f1de414550054aa43cf   0                   0B

Build cache usage: 0B

CACHE ID            CACHE TYPE          SIZE                CREATED             LAST USED           USAGE               SHARED
[root@nctest-snap-test-02 ~]# 

 

接下来,要定位谁占用的空间大,不是一目了然了吗


 

一份免费报告
揭示怎样仅仅通过阅读文章,就能每天赚到5000元现金!
该报告100%免费
所有你需要做的是,添加下面的微信,备注"免费报告"
 
 
image
posted @ 2022-08-17 15:14  Zhai_David  阅读(1319)  评论(0编辑  收藏  举报