docker学习inspect命令

Posted 懒佯佯大哥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker学习inspect命令相关的知识,希望对你有一定的参考价值。

待补充

zhaoyue@zhaoyuedeMacBook-Pro ~ % docker inspect 3eda31c046d5
[
    
        "Id": "3eda31c046d552f53db240ea103fe1a70f2c711f379433a7a9ef152c0b91ffd0",
        "Created": "2020-05-26T07:17:46.7974837Z",
        "Path": "catalina.sh",
        "Args": [
            "run"
        ],
        "State": 
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 7276,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2020-05-26T07:17:47.1282966Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        ,
        "Image": "sha256:1b6b1fe7261ea2f94c5911ad04395cb8d05428cad39fa60e9fee556f79e9afc2",
        "ResolvConfPath": "/var/lib/docker/containers/3eda31c046d552f53db240ea103fe1a70f2c711f379433a7a9ef152c0b91ffd0/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/3eda31c046d552f53db240ea103fe1a70f2c711f379433a7a9ef152c0b91ffd0/hostname",
        "HostsPath": "/var/lib/docker/containers/3eda31c046d552f53db240ea103fe1a70f2c711f379433a7a9ef152c0b91ffd0/hosts",
        "LogPath": "/var/lib/docker/containers/3eda31c046d552f53db240ea103fe1a70f2c711f379433a7a9ef152c0b91ffd0/3eda31c046d552f53db240ea103fe1a70f2c711f379433a7a9ef152c0b91ffd0-json.log",
        "Name": "/new_24",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": 
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": 
                "Type": "json-file",
                "Config": 
            ,
            "NetworkMode": "default",
            "PortBindings": ,
            "RestartPolicy": 
                "Name": "no",
                "MaximumRetryCount": 0
            ,
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [
                "hungry_herschel"
            ],
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "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,
            "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/74fb4ba4b099ec82a1a3215f9cda35f4889da59222cb73ba3d9d91e931f9b52a-init/diff:/var/lib/docker/overlay2/7c36eed283d796641a995ce0224219169adff1ff7ab9953e4c31890f51b19851/diff:/var/lib/docker/overlay2/8f70bb6e512bba14b47fb757baba8d611c5160bd602d3e9d510df7ab5c29a9b9/diff:/var/lib/docker/overlay2/3f8d381e0e4871f93f94843dc6c9e13c705504d733d88786efdeffe1eb226afa/diff:/var/lib/docker/overlay2/4ef5922c4bfe574f6d790c5b47661289ab8aa585152306320c59c759c5745be0/diff:/var/lib/docker/overlay2/ad8ccc75aeaadb96ccc37a7bfd968aa18c5a7f188f84fa853ae839fd6229e418/diff:/var/lib/docker/overlay2/c92dc377ae60cf7983627c0fef371a28f37c28955177d1e81ed81c42881866d9/diff:/var/lib/docker/overlay2/416d601e0d7e15b979a56abd9ccfd22d8a5b7b6e610dfcc0f6fdc26b70a33a76/diff:/var/lib/docker/overlay2/326e8ef78ce72a5ae8141966fc8a775eb4268af8a83eceb9c9053a8f0c8d715e/diff:/var/lib/docker/overlay2/3d4b89e0cc0987cc6b5a50ff12993bfe225ec0897dbbc2a0079fa3a6aeaaa282/diff:/var/lib/docker/overlay2/4ed83fcb49aac69c4cb1df2bcc99b1887a1de1a741857c97050637ff5c0a7371/diff",
                "MergedDir": "/var/lib/docker/overlay2/74fb4ba4b099ec82a1a3215f9cda35f4889da59222cb73ba3d9d91e931f9b52a/merged",
                "UpperDir": "/var/lib/docker/overlay2/74fb4ba4b099ec82a1a3215f9cda35f4889da59222cb73ba3d9d91e931f9b52a/diff",
                "WorkDir": "/var/lib/docker/overlay2/74fb4ba4b099ec82a1a3215f9cda35f4889da59222cb73ba3d9d91e931f9b52a/work"
            ,
            "Name": "overlay2"
        ,
        "Mounts": [
            
                "Type": "bind",
                "Source": "/tmp/myHost",
                "Destination": "/tmp/cHost",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            
        ],
        "Config": 
            "Hostname": "3eda31c046d5",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": 
                "8080/tcp": 
            ,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/tomcat/bin:/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "JAVA_HOME=/usr/local/openjdk-11",
                "JAVA_VERSION=11.0.7",
                "JAVA_BASE_URL=https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_",
                "JAVA_URL_VERSION=11.0.7_10",
                "CATALINA_HOME=/usr/local/tomcat",
                "TOMCAT_NATIVE_LIBDIR=/usr/local/tomcat/native-jni-lib",
                "LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib",
                "GPG_KEYS=05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23",
                "TOMCAT_MAJOR=9",
                "TOMCAT_VERSION=9.0.35",
                "TOMCAT_SHA512=0db27185d9fc3174f2c670f814df3dda8a008b89d1a38a5d96cbbe119767ebfb1cf0bce956b27954aee9be19c4a7b91f2579d967932207976322033a86075f98"
            ],
            "Cmd": [
                "catalina.sh",
                "run"
            ],
            "Image": "tomcat",
            "Volumes": null,
            "WorkingDir": "/usr/local/tomcat",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": 
        ,
        "NetworkSettings": 
            "Bridge": "",
            "SandboxID": "3777bf5673a151769e2c6e9bcb0d89a3130e6c6f318f6c1513503ba15ef11370",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": 
                "8080/tcp": null
            ,
            "SandboxKey": "/var/run/docker/netns/3777bf5673a1",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "574694263a3bc98d8a82138140c3ec3c0325e7b5ed2afd6421e3c50dfbfe67a2",
            "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": "62067515bfbd22f1c293055752865b88b09a3ac892025a060fe220340b5f2dda",
                    "EndpointID": "574694263a3bc98d8a82138140c3ec3c0325e7b5ed2afd6421e3c50dfbfe67a2",
                    "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
                
            
        
    
]

以上是关于docker学习inspect命令的主要内容,如果未能解决你的问题,请参考以下文章

Docker命令学习

Docker 命令- inspect命令

Docker CLI docker config inspect 常用命令

docker 命令详解:inspect

Docker格式化输出命令:“docker inspect --format“

Docker格式化输出命令:“docker inspect --format“