docker 命令详解(十一):inspect

docker 命令详解(十一):inspect,第1张

一、命令作用

获取容器/镜像的元数据。

二、命令语法

docker inspect [OPTIONS] NAME|ID [NAME|ID...]

OPTIONS说明:

-f :指定返回值的模板文件。

-s :显示总的文件大小。

--type :为指定类型返回JSON。

三、使用示例

获取镜像 redash_worker:latest 的元信息:

[
    {
        "Id": "sha256:664ac2d6fcf9b0bef7e945f9d0925798899431a82bea638bddb33e2c15df744d",
        "RepoTags": [
            "redash_scheduler:latest",
            "redash_worker:latest"
        ],
        "RepoDigests": [],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2022-02-28T07:46:57.2164457Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "redash",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D",
                "PYTHON_VERSION=3.7.12",
                "PYTHON_PIP_VERSION=21.2.4",
                "PYTHON_SETUPTOOLS_VERSION=57.5.0",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/2caf84b14febcda8077e59e9b8a6ef9a680aa392/public/get-pip.py",
                "PYTHON_GET_PIP_SHA256=7c5239cea323cadae36083079a5ee6b2b3d56f25762a0c060d2867b89e5e06c5",
                "PIP_DISABLE_PIP_VERSION_CHECK=1",
                "PIP_NO_CACHE_DIR=1"
            ],
            "Cmd": [
                "server"
            ],
            "ArgsEscaped": true,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "/app",
            "Entrypoint": [
                "/app/bin/docker-entrypoint"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 1596982495,
        "VirtualSize": 1596982495,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/f99a8tbaap8r7oauqjbw367gp/diff:/var/lib/docker/overlay2/r6s90kuh9znsi8cmfyt3ze6um/diff:/var/lib/docker/overlay2/jevs7m8jc3t7ub7m9ntn0row6/diff:/var/lib/docker/overlay2/bgid9swhvs8j64d2s4cnpfavf/diff:/var/lib/docker/overlay2/hy8wa6b6pp8cqvq8h4s8r51jo/diff:/var/lib/docker/overlay2/npo04vmhdvm63cbdhgsjlwm5e/diff:/var/lib/docker/overlay2/ua6cngbs0d04rrqetrjmwjwsz/diff:/var/lib/docker/overlay2/s2txfz97tekd3cfke08po9j9b/diff:/var/lib/docker/overlay2/qekbolaaya24ek39hgj89k2p4/diff:/var/lib/docker/overlay2/y7oiycennd7vqh5xt0m8ibwji/diff:/var/lib/docker/overlay2/tpjjvsjci7651b5hqt469ko0m/diff:/var/lib/docker/overlay2/jjwxunfc8fwdn92qaaje6gg0u/diff:/var/lib/docker/overlay2/nv46xu7uucqivixhxuewtjlgu/diff:/var/lib/docker/overlay2/80bd6f8d0f041668eb09cc124215c860bf87d7ceb82242771534f82c4a7e9592/diff:/var/lib/docker/overlay2/2d578365c780ac0fdccb5fd22e40058b2e7104d4344fd78969f319b582aef0e8/diff:/var/lib/docker/overlay2/b0cc7b9641ae41e17712b850907c9c24e512b61ab5c09243d31279e4560f3b04/diff:/var/lib/docker/overlay2/59220e81f6ba8224e1da8095a9bfc7c2c168425a0fc537570df7ec2aa10d89a9/diff:/var/lib/docker/overlay2/463089dfa790a91c398afceeb4677786ba22737b20375a318c5f4f5d416d231f/diff",
                "MergedDir": "/var/lib/docker/overlay2/kkpy5e39udek1crau9286hqzc/merged",
                "UpperDir": "/var/lib/docker/overlay2/kkpy5e39udek1crau9286hqzc/diff",
                "WorkDir": "/var/lib/docker/overlay2/kkpy5e39udek1crau9286hqzc/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:f18b02b14138b6f9808f9843cc645e2edd64b02ca1c87e671355f56d1b4b5ec6",
                "sha256:8cc37281088bdc898d9a68d93419108caf2522bb9367ea576356f88631f19b6f",
                "sha256:a60279d138d8ca849ba9f9e57739581d3fd9ddbeda0f53791b00ecb655dde090",
                "sha256:534bda4f36dcd1fd59a054afa219ebe3fc180f6e085cb021450f5fee7a936421",
                "sha256:0024ad7f54fbfb4ec7ceee013bf8742a764a54ce0ebb83b21c091ee7d58c5b45",
                "sha256:3f19e0f4c148c2a22962ab10c8168e1b4d2884b6b01cc35f826e727839acc9fc",
                "sha256:3f75a9c2d06b9cde00994fc18ff07da051e6e03d4d3ad4ac30547317e652b677",
                "sha256:2c1c2cfcc72b768786b231ea9acd0e043e6560b78213030b997b86fb9a71f5b7",
                "sha256:cca9120604d52bd73f94b758415979e653048b524c05f0e81e6938a6977d6b3d",
                "sha256:d42eddfdb7b9a2970c132b5e776761d76f3f61fc8d2084d75ebaf196c92ef92a",
                "sha256:6faf7a5fb3d78bb4524c8b21c8c3e994fdb0f7ef18cb21106b3534bd12f1f88c",
                "sha256:d5f817a9654d2552a3a658433edf33bee43496515c300eeb53cb3afef2295c06",
                "sha256:e0413b6404adbb20357babc0af16e6827c5b86c7305e02f9a0ac0b10ec06b339",
                "sha256:c37080d82adc957cf37c894dceace9097bac5cd4eda74c626d334aad146be3cf",
                "sha256:d45db4eba62b6f151f5600c59d181709f33e282277819cd7569997e05cbc45c6",
                "sha256:c6458e3ac4fe4ced36d64b7c9e67c32d16b3ceb4cc5db5f781a3cc43c1e5497f",
                "sha256:a1f5fd016a6658c8b26b3a0c02c1ebbbf989039d3fe062c542dd558b461a8b73",
                "sha256:a976bf857a372b122d6f8f976062457524d922627789dc224118bd188b11cbaf",
                "sha256:820abe4c56a164fd3293eba2ef94ce999647df5a2d966ff03d4a2d9b071c51cb"
            ]
        },
        "Metadata": {
            "LastTagTime": "2022-02-28T07:47:06.0691099Z"
        }
    }
]

四、帮助查看

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/926690.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-16
下一篇 2022-05-16

发表评论

登录后才能评论

评论列表(0条)

保存