docker查看容器运行内存以及删除命令

删除线格式 —
title: docker查看容器运行内存以及删除命令
date: 2018-09-10 03:33:00
tags:

    Docker
    category:
    Docker
    description: docker查看容器运行内存以及删除命令

前言
1、docker使用cpu、内存、网络、io情况
1.1、docker stats 容器id

node3:~# docker stats 7a20f9671dbd
CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
7a20f9671dbd        0.09%               1.837GiB / 3.859GiB   47.61%              52.3MB / 28.7MB     3.32MB / 16.4kB     62


    1
    2
    3
    4
    5

1.2、-a 显示所有容器(默认显示刚刚运行)


node3:~# docker stats -a

CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
7a20f9671dbd        0.09%               1.837GiB / 3.859GiB   47.61%              52.4MB / 28.7MB     3.32MB / 16.4kB     62
4eeb00be3547        0.69%               34.3MiB / 3.859GiB    0.87%               0B / 0B             5.8MB / 0B          19
c52a162de8e8        0.23%               131MiB / 3.859GiB     3.32%               1.01GB / 860MB      3.25MB / 106kB      22
ff7ed47106ad        0.00%               11.98MiB / 3.859GiB   0.30%               0B / 0B             1.9MB / 11.3MB      9
33b6ad13d1dc        0.13%               3.48MiB / 3.859GiB    0.09%               800B / 0B           0B / 0B             8
06a1d01f5024        0.19%               6.973MiB / 3.859GiB   0.18%               0B / 0B             143kB / 5.37MB      23
5e03f86078fd        0.00%               15.06MiB / 3.859GiB   0.38%               0B / 0B             1.79MB / 4.1kB      13
c78ed69d6c66        0.01%               6.227MiB / 3.859GiB   0.16%               0B / 0B             0B / 0B             7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

1.3、显示多个容器的运行信息

docker stats rId1,rId2

    1

1、docker删除命令
1、删除所有已经停止的容器

docker rm $(docker ps -a -q)

    1
    2

2、删除所有未打 tag 的镜像

docker rmi $(docker images -q | awk '/^<none>/ { print $3 }')
        

    1
    2

3、模糊删除

docker images | grep registry.cn-qingdao.aliyuncs.com/duodianyouhui/dev-server | xargs docker rmi

原文地址:https://www.cnblogs.com/gdg87813/p/12214584.html