docker inspect command

[root@os-machine ~]# docker inspect --help 

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

Return low-level information on Docker objects

Options:
  -f, --format string   Format the output using the given Go template
      --help            Print usage
  -s, --size            Display total file sizes if the type is container
      --type string     Return JSON for specified type
[root@os-machine ~]# sudo docker inspect 27150dc6e94b
[
    {
        "Id": "27150dc6e94bae0ed89a02f57e132906491ad6b578fc096585cb220eb29a9773",
        "Created": "2018-06-04T06:04:39.592820956Z",
        "Path": "/bin/bash",
        "Args": [],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2018-06-04T06:04:39.94807597Z",
            "FinishedAt": "2018-06-04T06:04:40.041887322Z"
        },
        "Image": "sha256:44ae5d2a191e49f4a4de97a8b3e50049333d64e283bb2aa397815bbe01398a24",
        "ResolvConfPath": "/var/lib/docker/containers/27150dc6e94bae0ed89a02f57e132906491ad6b578fc096585cb220eb29a9773/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/27150dc6e94bae0ed89a02f57e132906491ad6b578fc096585cb220eb29a9773/hostname",
        "HostsPath": "/var/lib/docker/containers/27150dc6e94bae0ed89a02f57e132906491ad6b578fc096585cb220eb29a9773/hosts",
        "LogPath": "",
        "Name": "/stoic_ardinghelli",
        "RestartCount": 0,
        "Driver": "overlay2",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "journald",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "docker-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": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Name": "overlay2",
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/e1a3fb79aa2001dac6ad9fc8639e232e4f3cffcce20a8fb3edbf1ffd417fa2f3-init/diff:/var/lib/docker/overlay2/d736280cbbf1b67bf15ce793229c7115449459fd1b8172235694dfb0ac59e622/diff:/var/lib/docker/overlay2/b15fcb1d0975f70be3e93244951dfa4357c60bb95236ce3d3a1d27be1e990d1d/diff:/var/lib/docker/overlay2/9bad79c95f340475e2e83ff964613590f6281f197ad2c8dcf606c93965e692cd/diff:/var/lib/docker/overlay2/f2de74cdf4e2065335a6e7d1bb3d8955fbafde138ecd2f0f6fb62f1bb6bedb9a/diff",
                "MergedDir": "/var/lib/docker/overlay2/e1a3fb79aa2001dac6ad9fc8639e232e4f3cffcce20a8fb3edbf1ffd417fa2f3/merged",
                "UpperDir": "/var/lib/docker/overlay2/e1a3fb79aa2001dac6ad9fc8639e232e4f3cffcce20a8fb3edbf1ffd417fa2f3/diff",
                "WorkDir": "/var/lib/docker/overlay2/e1a3fb79aa2001dac6ad9fc8639e232e4f3cffcce20a8fb3edbf1ffd417fa2f3/work"
            }
        },
        "Mounts": [],
        "Config": {
            "Hostname": "27150dc6e94b",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": [
                "/bin/bash"
            ],
            "Image": "ubuntu:14.04.2",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "5d908d49cf3a2295cf79ea9311c7424cfb18ae204f042924951b942ceb5545bf",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": null,
            "SandboxKey": "/var/run/docker/netns/5d908d49cf3a",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "3faaa1380970f952b59fea38ad8073214a404109351a56d5ce626ba12416266b",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": ""
                }
            }
        }
    }
]

#inspecting the container's pid
sudo docker inspect -f {{.State.Pid}} 27150dc6e94b

猜你喜欢

转载自blog.51cto.com/huwho/2124534