我在使用Docker for Mac以及docker-compose运行着nginx,以下是docker inspect
中的"Networks"部分。
{
"Networks": {
"laradock_backend": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"c189cabxfdf9",
"nginx"
],
"NetworkID": "f4f8d8ff07ae90d5758644968d96f2g653fc5188c895f19c2d08de92c46cc075",
"EndpointID": "f8c6d5a8b061c75c44c2e078a65928a9b45dd91833fc05x7f249c64a180e84a1",
"Gateway": "172.21.0.1",
"IPAddress": "172.21.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:02:fc:15:10:05",
"DriverOpts": null
},
"laradock_frontend": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"c189cab4ddg1",
"nginx"
],
"NetworkID": "7b410b1bd764617a3f6146862307f886681e57aaxf057e4308f1236e1558ffcb",
"EndpointID": "0caa62bc5bbx600a5b1f260ebg11014e05394671ca347f818bfx819f43f7011e",
"Gateway": "172.22.0.1",
"IPAddress": "172.22.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "01:41:af:16:00:03",
"DriverOpts": null
}
}
}
我不是计算机网络方面的专家。但我经常使用docker,我只是想更好地理解每当我通过我的主机(localhost)连接到docker容器时发生了什么。
我发现每个网络都有一个“网关”。 我在我的主机上找不到这样的接口。网关在哪里?为什么我们需要这样一个东西?
任何简单的图表都会很有帮助... 谢谢。