我需要获取Windows主机上的Docker容器的内部IP地址

时间:2019-06-16 21:30:00

标签: docker zap

我需要获取Docker容器的内部IP地址,以连接部署在主机上的应用程序。根据{{​​3}},命令$(ip -f inet -o addr show docker0 | awk '{print $4}' | cut -d '/' -f 1)是获得有效ip地址所必需的。但是,该命令不适用于Windows OS。我想知道是否有等效的命令或替代方法来获取Windows主机上应用程序的IP地址,以允许Docker容器访问它们。在我的特定用例中,容器正在运行官方的OWASP ZAP映像,并且需要扫描Windows主机上运行的应用程序。

运行命令时出现以下错误:

PS C:\xx\xx> $(ip -f inet -o addr show docker0 | awk '{print $4}' | cut -d '/' -f 1)
ip : The term 'ip' is not recognized as the name of a cmdlet, function, 
script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At line:1 char:3
+ $(ip -f inet -o addr show docker0 | awk '{print $4}' | cut -d '/' -f  ...
+   ~~
+ CategoryInfo          : ObjectNotFound: (ip:String) [], 
CommandNotFoundException

0 个答案:

没有答案
相关问题