yujin2010good
作者yujin2010good·2019-01-09 09:57
系统工程师·大型零售巨头

docker inspect 过滤

字数 7694阅读 1432评论 0赞 3
[root@localhost _data]# docker inspect d2
[
    {
        "Id": "a51de6c5033d0eb8628640ea688916cbdee981756a44082097aa99a466b62e53",
        "Created": "2018-12-23T15:30:40.297651312Z",
        "Path": "sh",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 13828,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2018-12-23T15:30:41.519762909Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:59788edf1f3e78cd0ebe6ce1446e9d10788225db3dedcfd1a59f764bad2b2690",
        "ResolvConfPath": "/var/lib/docker/containers/a51de6c5033d0eb8628640ea688916cbdee981756a44082097aa99a466b62e53/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/a51de6c5033d0eb8628640ea688916cbdee981756a44082097aa99a466b62e53/hostname",
        "HostsPath": "/var/lib/docker/containers/a51de6c5033d0eb8628640ea688916cbdee981756a44082097aa99a466b62e53/hosts",
        "LogPath": "/var/lib/docker/containers/a51de6c5033d0eb8628640ea688916cbdee981756a44082097aa99a466b62e53/a51de6c5033d0eb8628640ea688916cbdee981756a44082097aa99a466b62e53-json.log",
        "Name": "/d2",
        "RestartCount": 0,
        "Driver": "devicemapper",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/data/volumes/b2:/data"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": true,
            "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/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/asound",
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "DeviceId": "243",
                "DeviceName": "docker-253:0-67471500-d7a03c14cd540ab08fd2de33e4ab2a2269df30ac85e7df1a4dda905e2c066520",
                "DeviceSize": "10737418240"
            },
            "Name": "devicemapper"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/data/volumes/b2",
                "Destination": "/data",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "a51de6c5033d",
            "Domainname": "",
            "User": "",
            "AttachStdin": true,
            "AttachStdout": true,
            "AttachStderr": true,
            "Tty": true,
            "OpenStdin": true,
            "StdinOnce": true,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "sh"
            ],
            "ArgsEscaped": true,
            "Image": "busybox",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "853bdeba542594d553aaaab6fd081309e08f96db67fc9b9c1aaceeeef8c3fa74",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/853bdeba5425",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "e7a332806b088bfc2ea02784ffd66b8cad1b9378317f49189c9e4ff98dbf06a7",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "70927cee27d5e7ec40b7f14d28fca615a5d6786533e3dd94d380021b414eec72",
                    "EndpointID": "e7a332806b088bfc2ea02784ffd66b8cad1b9378317f49189c9e4ff98dbf06a7",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:03",
                    "DriverOpts": null
                }
            }
        }
    }
]
[root@localhost _data]# docker inspect -f {{.Mounts}} d2
[{bind  /data/volumes/b2 /data   true rprivate}]
[root@localhost _data]# docker inspect -f {{.NetworkSettings}} d2
{{ 853bdeba542594d553aaaab6fd081309e08f96db67fc9b9c1aaceeeef8c3fa74 false  0 map[] /var/run/docker/netns/853bdeba5425 [] []} {e7a332806b088bfc2ea02784ffd66b8cad1b9378317f49189c9e4ff98dbf06a7 172.17.0.1  0 172.17.0.3 16  02:42:ac:11:00:03} map[bridge:0xc4205d0000]}
[root@localhost _data]# docker inspect -f {{.NetworkSettings.IPAddress}} d2
172.17.0.3

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

3

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广