如何从docker容器中获取主机eth0 wlan0的ip地址

时间:2018-01-03 11:08:42

标签: docker networking

我在主机上运行了一个docker容器。如果我"source": { "id": "the-hindu", "name": "The Hindu" }, "author": "", "title": "Questionable remedy: on the National Medical Commission Bill"``, "description": "Key sections of the National Medical Commission Bill need a rethink", "url": "http://www.thehindu.com/opinion/editorial/questionable-remedy/article22354009.ece", "urlToImage": "http://www.thehindu.com/static/theme/default/base/img/og-image.jpg", "publishedAt": null }, -{ -"source": { "id": "the-hindu", "name": "The Hindu" }, "author": "", "title": "On the ledger: on fiscal consolidation", "description": "Expenditure data underline the government’s challenge on fiscal consolidation", "url": "http://www.thehindu.com/opinion/editorial/on-the-ledger/article22354014.ece", "urlToImage": "http://www.thehindu.com/static/theme/default/base/img/og-image.jpg", "publishedAt": null } } } ,它会给出分配给容器的IP地址。此IP地址是docker为其虚拟网络创建的IP地址。

我所拥有的主持人有ip addr show wlan0。有什么方法可以获得主机的eth0wlan0的IP地址。

谢谢

1 个答案:

答案 0 :(得分:0)

是的,您必须将网络模式更改为" host"。

https://docs.docker.com/engine/reference/run/#network-settings