微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Docker system 命令 查看docker镜像磁盘占用情况 Docker volume 相关

内容From

https://docs.docker.com/engine/reference/commandline/system_df/

docker的image和docker的container都会占用磁盘, 但是不知道具体占用的多少时可以使用docker system 命令来查看

首先看一下 帮助信息 

Usage:    docker system COMMAND

Manage Docker

Options:
      --help   Print usage

Commands:
  df          Show docker disk usage
  events      Get real time events from the server
  info        display system-wide information
  prune       Remove unused data

Run 'docker system COMMAND --help' for more information on a command.

查看磁盘占用情况的命令

[root@server-01 ~]# docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLaimABLE
Images          2         2         2.874GB   0B (0%)
Containers      2         1         41.14MB   41.13MB (99%)
Local Volumes   45        4         1.14GB    918.4MB (80%)
Build Cache     0         0         0B        0B
[root@server-01 ~]# 

如果想查看 具体每个docker image 或者是container的占用量 可以使用 增加 -v or --verbose 进行详细显示

一个展示结果为:

[root@server-01 ~]# docker system df  -v
Images space usage:

REPOSITORY               TAG       IMAGE ID       CREATED         SIZE      SHARED SIZE   UNIQUE SIZE   CONTAINERS
jumpserver/jms_all       latest    a91591569483   4 weeks ago     2.482GB   0B            2.482GB       1
gluster/gluster-centos   latest    b2919ab8d731   12 months ago   392.3MB   0B            392.3MB       1

Containers space usage:

CONTAINER ID   IMAGE                       COMMAND                  LOCAL VOLUMES   SIZE      CREATED        STATUS                      NAMES
577cbedc0abb   jumpserver/jms_all:latest   "./entrypoint.sh"        3               41.1MB    24 hours ago   Exited (137) 23 hours ago   jms_all
82a8137c18de   gluster/gluster-centos      "/usr/local/bin/upda…"   1               5.05kB    4 days ago     Up 5 minutes                gluster

Local Volumes space usage:

VOLUME NAME                                                        LINKS     SIZE
28232dfdf9eb4c08e87265c0915b2f1fc95c098ac293b4ccc91f21fc65986175   0         0B
393c8f10ec342edc91579714fdaddb8f0b5357501c8082ea099e8b41d8c0f948   0         0B
78ec80b3422364717a3147bdaf49ebd10ab53947bddaf0edf393e681a69a0aea   1         240B
7a5598fd2b63c9137a85e40465e1da75e6ddaf164399906b87b07e2cebcede06   0         0B
c6a996d3e6cc7aa4efba6eb57a1bb362082e6d15cb8f4cae53eb245cbb1f6233   0         73B
d3f48d7cc08d30167a627eda2d47b845fa92ad62a38efdcbdf99f0c16e73fb9a   0         222.1MB
12d12ac620ae1d15a3ecb5cf8ce414398f44f2bd8f0bf7a3d56d77633727940a   0         0B
3732fffea436e55acd7e808e7ac5f32eef989e9f2f698cdfe5a0f165d7e1c233   0         21.32MB
4f55f4787eb7bfa885194e63d97a58262b223ee42ef86ae290204eb186d8fd56   0         0B
b44ffc893d1812a9cac0b45a5d36aed231c06846d18fcfd605178cc31e314549   0         0B
d088f0df477bbb3af21e59ccb2c797644e2af4ea6ac8cbb383afd615697aed6d   0         0B
389978dc0a2e585109bd5ea16534d33dcfa0d69fa21e5cf9b3b22e296c114b84   1         222MB
4aa5b1166391cb58766e4de9f0d0c55db603894a80338c9112d2af2378567847   1         0B
619415df7af84d744b8ec04f0539c6ec025969620bfcd15ad895f9c2e7327799   0         0B
9157e53459d3cdf4d0b9c3c71e5e81378a38eca28f4b3e0bb3cd1d9fdee260dd   0         0B
a48feecb072dab6dc0081dfc48b0ca7bcca7537fe35e5f37d24abff4f44e6652   0         0B
ae2911af3c640d525169d25135b29c504d7e04247cf42620bb35ee5daae1da66   0         0B
bec53661e99473ef2681d01b4ca8fa1ffa625a73fe2b7f7cd84fac79a5962b1b   0         0B
f55b80ce4389ba6313ac4526ce59f38929b8d11eaac7f0e603cea0274587e9e8   0         0B
3b607f80ab18db5d9e444780031d0af869b2c720dcdabd4c91482083ea2679c5   0         0B
63ce10968fd58eb63916383720dd2e3f2d1901b969903b0e827c1ed08111c627   0         8.025kB
781f5f4d2c9384c814a0f519c2503bfeea9977af41a58939d0c4b0b148650c5f   0         240B
cd4a84790ad0e8eaaaefdd12c3852cd0dda6b9cdb6c355a351082cf022daabd4   0         0B
2aaf29cabdbd7442044d152b03685f58fbb5b9257456df5538040ae62ba9eaaa   0         240B
322d08f0ba83e8b7868811b4cfedcd0f467f2663643b96748df9869d936a75df   0         0B
47526c71c81c0513deaa7887b8325133b05d871a32b408f1191d40e47f92cf8e   0         73B
4d6c7d65a1edef8f5782353dd591269292cf1374c2c97c108343a0dc81f8a9ea   0         240B
8965af6920ee90a2ff66eb0622b70bb9370719b267b94d19b1c09b9651ed497a   0         0B
b5c68a50b4fd157f9d1d54a1361ad78580c21a9974fa39a8938e2db341745e4d   0         0B
f20ea6df963794130f6d544c25be5480eb40bf1b60ff5c996d5699e521f801c0   0         222.1MB
1c030028b2e9c78cd1f17dceccdde0292bb2769ec72ba4ceddea9cdf46d054a5   0         0B
4749978ee58dfd3bae2dab19d9fb374fc4c2f6d6ba801e6bf0512f59201c5207   0         0B
d1cd74df2c15832a04e37e2c9bb568aad8bf71c6b9e34f7fd5f14d3a1baec6a5   0         168B
e80ca51ead4086cbe7e7155be78d9a67a597921c64d6d7a33e4e79e036b17c3b   0         209.5MB
f210ce5d79d1478684d9d7a752587f955d2b5e8d3a1d25cb26762d3e7fb46cd3   1         5.298kB
102dcb1b0cafe940ea1c2f6270c994293e490f4c47c110ec4c2eded1c5dd2585   0         0B
dac9a5ee661c47fce7631b87faf58a37d65a4471ac025ff900da84493339608b   0         0B
f9289ac224f4a9554ca2ded7086f5ae078668a063e616bfc6cb8ea5fa598724b   0         21.32MB
0980676f0ced18aa1fe9b08f704b23905574c2de5f0dba80a1ec11138ba94598   0         0B
0d2a55d67cff0449910ed3aafc9832067911bc33a669c55bea086ac2aa81f4a0   0         222.1MB
425273e99a904562661ba4954c9514839d5dbd96acf1c16ac2afd24f38dc28ea   0         0B
59ea66e5b5f89f250220fc437b7c860f420d0dc80ef1033d669f8eab06515512   0         0B
74a3dcfc0bd71f3b10f5efad969eaa2dc114179ee8b7dd02a092f16f34531825   0         7.393kB
8f2af99113258344c80fb982c7876db85efd3ffeacc5a5c5a8a427099a7dc49f   0         0B
def8d003b795fe02bcd4a99229ff9534a8c0e6eb28dbd771c1edba3bcfc5e163   0         0B

Build cache usage: 0B

CACHE ID   CACHE TYPE   SIZE      CREATED   LAST USED   USAGE     SHARED

2. docker volume 可以创建 卷 用来保证镜像关闭或者删除时 能够保存数据

创建命令

docker volume create 

可以保存备份这样的卷信息用来防止信息丢失.

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐