1.inspect介绍
Docker网络命令inspect是用来查看Docker网络的详细信息
2.inspect用法
docker network inspect [参数] NETWORK
[root@centos79 ~]# docker network inspect --help
Usage: docker network inspect [OPTIONS] NETWORK [NETWORK...]
Display detailed information on one or more networks
Options:
-f, --format string Format output using a custom template:
'json': Print in JSON format
'TEMPLATE': Print output using the given Go template.
Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates
-v, --verbose Verbose output for diagnostics
[root@centos79 ~]#
3.inspect样例
3.1.查看Docker网络数据源信息
命令:
docker network inspect bridge
[root@centos79 ~]# docker network ls
NETWORK ID NAME DRIVER SCOPE
3c318451380b bridge bridge local
806f281c40a3 elk bridge local
6dfaabaf6333 host host local
e33f2e7fe685 mynet1 bridge local
8a8734a4776a none null local
[root@centos79 ~]# docker network inspect bridge
[
{
"Name": "bridge",
"Id": "3c318451380bdb8e85e8a41f028b1058106d0a1c7884b2ca18793065bac49d85",
"Created": "2023-12-28T08:41:31.441878439+08:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
[root@centos79 ~]#
"com.docker.network.bridge.name": "docker0",
从此处也可以看出docker的默认网桥为啥叫docker0,即在此处进行的定义。