查看运行中的Docker容器的挂载目录等信息

执行命令

container_id 容器id

docker inspect container_id

完整结果

[
    {
        "Id": "b397d0449294c58a47efd7cacbaaf4b663e38df08262a9b44ec8e48f4b37617b",
        "Created": "2020-08-27T02:03:34.1006192Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "agent",
            "-dev",
            "-client",
            "0.0.0.0"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 3746,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2020-09-02T09:02:31.2798418Z",
            "FinishedAt": "2020-09-02T09:02:22.1429919Z"
        },
        "Image": "sha256:d92e348410062c208f8d07b8da3618984d8e4ec818586d61cb0ee4e63e91aee8",
        "ResolvConfPath": "/var/lib/docker/containers/b397d0449294c58a47efd7cacbaaf4b663e38df08262a9b44ec8e48f4b37617b/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/b397d0449294c58a47efd7cacbaaf4b663e38df08262a9b44ec8e48f4b37617b/hostname",
        "HostsPath": "/var/lib/docker/containers/b397d0449294c58a47efd7cacbaaf4b663e38df08262a9b44ec8e48f4b37617b/hosts",
        "LogPath": "/var/lib/docker/containers/b397d0449294c58a47efd7cacbaaf4b663e38df08262a9b44ec8e48f4b37617b/b397d0449294c58a47efd7cacbaaf4b663e38df08262a9b44ec8e48f4b37617b-json.log",
        "Name": "/apps_consul_1",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {
                    "max-file": "4",
                    "max-size": "50m"
                }
            },
            "NetworkMode": "apps_sanic-network",
            "PortBindings": {
                "8500/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "8500"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [],
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "shareable",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/3e52f0e58bd7be342a87e7736db00144915f84c0a10a503304118ad0184ce913-init/diff:/var/lib/docker/overlay2/bba751bbadc2800acec527cd6ae0a6fae7e13ae46ce8d282134fe880e0b87c9b/diff:/var/lib/docker/overlay2/cc8d164804fe292acdb530ba7709c3a77e72fd995ffea6d7e7ebf902f3e83ccd/diff:/var/lib/docker/overlay2/7d2b61d4549bd413bbfa2ce30a779eebd4dd7c23e1d74dcdaf3591b9178e296e/diff:/var/lib/docker/overlay2/edaa3cb922c83772f30636a378feb9aa9b6071fe796cb15f20dc00e0d8a926d5/diff:/var/lib/docker/overlay2/55f861f918fed29e008b5ebac667d5ce77284d1025402379db6306dbbe6ae990/diff:/var/lib/docker/overlay2/a51a194b81ef9c30689e5e81128d49b073d0ab93136cba9411812451d27ac7e1/diff",
                "MergedDir": "/var/lib/docker/overlay2/3e52f0e58bd7be342a87e7736db00144915f84c0a10a503304118ad0184ce913/merged",
                "UpperDir": "/var/lib/docker/overlay2/3e52f0e58bd7be342a87e7736db00144915f84c0a10a503304118ad0184ce913/diff",
                "WorkDir": "/var/lib/docker/overlay2/3e52f0e58bd7be342a87e7736db00144915f84c0a10a503304118ad0184ce913/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "8f3bde44a3604dbc7ba4b3b4efe0f8ce34b24f023f0e9d5544573cfde423e319",
                "Source": "/var/lib/docker/volumes/8f3bde44a3604dbc7ba4b3b4efe0f8ce34b24f023f0e9d5544573cfde423e319/_data",
                "Destination": "/consul/data",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "b397d0449294",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "8300/tcp": {},
                "8301/tcp": {},
                "8301/udp": {},
                "8302/tcp": {},
                "8302/udp": {},
                "8500/tcp": {},
                "8600/tcp": {},
                "8600/udp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "CONSUL_BIND_INTERFACE:eth0",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "CONSUL_VERSION=1.4.4",
                "HASHICORP_RELEASES=https://releases.hashicorp.com"
            ],
            "Cmd": [
                "agent",
                "-dev",
                "-client",
                "0.0.0.0"
            ],
            "Image": "consul:1.4.4",
            "Volumes": {
                "/consul/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "d07aebbdbf5a708ab3e6f4b838f824c796afa0a66e37e59001d839160eb4edaf",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "apps",
                "com.docker.compose.service": "consul",
                "com.docker.compose.version": "1.24.1"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "f6d8d572b6e179a3928c3be84fd1a2da1dfcda8b8adb0e4003e7d41dfc5de21a",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "8300/tcp": null,
                "8301/tcp": null,
                "8301/udp": null,
                "8302/tcp": null,
                "8302/udp": null,
                "8500/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "8500"
                    }
                ],
                "8600/tcp": null,
                "8600/udp": null
            },
            "SandboxKey": "/var/run/docker/netns/f6d8d572b6e1",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "apps_sanic-network": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "b397d0449294",
                        "consul"
                    ],
                    "NetworkID": "b752ac6f0b9d2b049f0146eccdfd9eaacc277be67f595bf0f6815af56283981e",
                    "EndpointID": "154196a3ae86eb3b09bb3b88154a0f14d6cc379e25f92acdee99218454c701e4",
                    "Gateway": "172.20.0.1",
                    "IPAddress": "172.20.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:14:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]
docker 
更新时间:2017-11-08 15:57:52

本文由 智慧煮粥 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
原文链接:http://zz.zzhub.cn/archives/dockerinspect
最后更新:2017-11-08 15:57:52

评论

Your browser is out of date!

Update your browser to view this website correctly. Update my browser now

×