Saturday 9 May 2020

Docker: inspect: Get more details about container

‘docker inspect {containerId/containerName}’ command is used to get more details about the container in json format.

Example
$docker inspect bda7390cac5b
[
    {
        "Id": "bda7390cac5baa788bcc2292c6376855940449b044d4275037c8d8f8daa02582",
        "Created": "2019-08-30T18:29:55.3309368Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "mysqld"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 5409,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-08-30T18:29:55.9240131Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:62a9f311b99c24c0fde0a772abc6030bc48e5acc7d7416b8eeb72d3da1b4eb6c",
        "ResolvConfPath": "/var/lib/docker/containers/bda7390cac5baa788bcc2292c6376855940449b044d4275037c8d8f8daa02582/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/bda7390cac5baa788bcc2292c6376855940449b044d4275037c8d8f8daa02582/hostname",
        "HostsPath": "/var/lib/docker/containers/bda7390cac5baa788bcc2292c6376855940449b044d4275037c8d8f8daa02582/hosts",
        "LogPath": "/var/lib/docker/containers/bda7390cac5baa788bcc2292c6376855940449b044d4275037c8d8f8daa02582/bda7390cac5baa788bcc2292c6376855940449b044d4275037c8d8f8daa02582-json.log",
        "Name": "/mySqlServer_1",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/Users/Shared/datadir:/var/lib/mysql"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "3306/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "3306"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": 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": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "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/c8e2aaad4e3ae3f4c1458a776ad261164bc232267e99e83e2aeb365c271ad651-init/diff:/var/lib/docker/overlay2/9f307d7e99b69d1e8e5e00ced86fb93b17c48e89696f8df57b461c4aa582a914/diff:/var/lib/docker/overlay2/bd785e427f010228ec509c23030fcf88a26c9774ac19c5e884fa669a0b2b3195/diff:/var/lib/docker/overlay2/43f80e620ec70664547f329048b7b3f5bcd42e4b6ba11205f12bf1275c4801fc/diff:/var/lib/docker/overlay2/260170b54bf2dcbc6d9c9d5e65c61d3bd99ffe3831413713f6d8a632212b766d/diff:/var/lib/docker/overlay2/3b4895b5045f26846b03276733b022856dacc3dd9d3fc095b7c54baf7e275ad2/diff:/var/lib/docker/overlay2/8c1f6a89e6e62a5f448448ea9a35e6ef8a934afefb97805aa57bde56dda8bef9/diff:/var/lib/docker/overlay2/d2d710a9ff0da3cd2cc2e1deb8a97b9cae5cc558aafffd52cb4f31b604f15de0/diff:/var/lib/docker/overlay2/a0fcd3b88ea0a0c8256f1b73bd2016656389982ecb6a9d146cc6babcd7c9771d/diff:/var/lib/docker/overlay2/da3ee694f9ad03eeb54e0a5067a70438e0390fb3077ec242bb508453c9afb312/diff:/var/lib/docker/overlay2/d6e41e69f6d968b964785f8ac1033d97ef025328f7af5f51c8071e3f503204da/diff:/var/lib/docker/overlay2/a001fcf09a5d4c10b3f425ebb09f48f806441d4b64236aa46b11f7673d1dc2d9/diff:/var/lib/docker/overlay2/cc4c7a749fdcbfb2bc797c20b39e3a579705314cc634506011152960a1a11b17/diff",
                "MergedDir": "/var/lib/docker/overlay2/c8e2aaad4e3ae3f4c1458a776ad261164bc232267e99e83e2aeb365c271ad651/merged",
                "UpperDir": "/var/lib/docker/overlay2/c8e2aaad4e3ae3f4c1458a776ad261164bc232267e99e83e2aeb365c271ad651/diff",
                "WorkDir": "/var/lib/docker/overlay2/c8e2aaad4e3ae3f4c1458a776ad261164bc232267e99e83e2aeb365c271ad651/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/Users/Shared/datadir",
                "Destination": "/var/lib/mysql",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "bda7390cac5b",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3306/tcp": {},
                "33060/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "MYSQL_ROOT_PASSWORD=tiger",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "MYSQL_MAJOR=8.0",
                "MYSQL_VERSION=8.0.17-1debian9"
            ],
            "Cmd": [
                "mysqld"
            ],
            "ArgsEscaped": true,
            "Image": "mysql",
            "Volumes": {
                "/var/lib/mysql": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "15d54385d52fb95d6aecefb47a0fb23d7d43fbed1329980bca36f546a71887e5",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3306"
                    }
                ],
                "33060/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/15d54385d52f",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "2b00bb1d496d12fcb2b64f3657ea7cdb7ac69c742f53452987eaa345807db257",
            "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": "c6ce40fd584448ab73a31e24c94da9edc37e0f5b4fb2078b19eae2e60fb1d771",
                    "EndpointID": "2b00bb1d496d12fcb2b64f3657ea7cdb7ac69c742f53452987eaa345807db257",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]


Previous                                                    Next                                                    Home

No comments:

Post a Comment