Docker inspect: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:
=Overview=
=Overview=


Return low-level information on a container, image or task. The returned data includes [[Docker_Concepts#Labels|labels]], the [[Docker_Concepts#Entrypoint|entrypoint]], etc.
Generates low-level metadata for a container, image or task. The returned data includes [[Docker_Concepts#Labels|labels]], the [[Docker_Concepts#Entrypoint|entrypoint]], etc.


  docker inspect &#91;[[Docker_inspect#-f.2C_--format|-f]] <''format-spec''>] <''container-id''>|<''image-name''>
  docker inspect &#91;[[Docker_inspect#-f.2C_--format|-f]] <''format-spec''>] <''container-id''>|<''image-name''>

Revision as of 17:29, 5 December 2017

External

Internal

Overview

Generates low-level metadata for a container, image or task. The returned data includes labels, the entrypoint, etc.

docker inspect [-f <format-spec>] <container-id>|<image-name>

Output Example

[
    {
        "Id": "812054849eb1a3608dae86ebe9bdb65698b532ce1f45d3243254ce4eecfe312e",
        "Created": "2017-11-20T02:17:31.998327368Z",
        "Path": "/bin/sh",
        "Args": [
            "-c",
            "i=0; while true; do echo ${i}; i=$(expr ${i} + 1);  sleep 1s; done"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 112161,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-11-20T02:36:45.241973832Z",
            "FinishedAt": "2017-11-20T02:35:50.929935706Z"
        },
        "Image": "sha256:6ad733544a6317992a6fac4eb19fe1df577d4dec7529efec28a5bd0edad0fd30",
        "ResolvConfPath": "/var/lib/docker/containers/812054849eb1a3608dae86ebe9bdb65698b532ce1f45d3243254ce4eecfe312e/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/812054849eb1a3608dae86ebe9bdb65698b532ce1f45d3243254ce4eecfe312e/hostname",
        "HostsPath": "/var/lib/docker/containers/812054849eb1a3608dae86ebe9bdb65698b532ce1f45d3243254ce4eecfe312e/hosts",
        "LogPath": "",
        "Name": "/tiny_saha",
        "RestartCount": 0,
        "Driver": "devicemapper",
        "MountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c209,c591",
        "ProcessLabel": "system_u:system_r:svirt_lxc_net_t:s0:c209,c591",
        "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,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 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": "devicemapper",
            "Data": {
                "DeviceId": "185",
                "DeviceName": "docker-253:3-12968682-4a748c153f68ef03ac58e24a9bcee1db6934a9e36ab448ba5aef3ed11cffdf4b",
                "DeviceSize": "10737418240"
            }
        },
        "Mounts": [],
        "Config": {
            "Hostname": "812054849eb1",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "i=0; while true; do echo ${i}; i=$(expr ${i} + 1);  sleep 1s; done"
            ],
            "Image": "busybox",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "b9021164d0abcf5df1bc092fa74aaf250ea8adcc4f8607a0d4159779ce93b4f8",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/b9021164d0ab",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "5ca811c6bbfda0f8a23a4a613a02e2ea9a9682b348dd1df95cd7b30615c309a7",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "f5c047beeaa11a7b83d0ef1f9f220b30d06fcf585d6e0d4cb6bec023cf0db379",
                    "EndpointID": "5ca811c6bbfda0f8a23a4a613a02e2ea9a9682b348dd1df95cd7b30615c309a7",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02"
                }
            }
        }
    }
]

Options

-f, --format

Format the output using the given go template.

-f '{{json .Mounts}}'