Docker inspect 取出對應的值

當要自 docker inspect 中取出值時,做法一直搞不是很清楚,後來看到一個博客上說明的很清楚,留下連結以便自己未來能再來查

[root@k8s ~]# docker inspect my_tomcat -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
172.17.0.2
[root@k8s ~]# docker inspect my_tomcat -f '{{index .NetworkSettings.Networks.bridge.IPAddress }}'
172.17.0.2
[root@k8s ~]#

參考連結: https://yq.aliyun.com/articles/230067

 

Author: jerryw1974

learning and focus on computer science, cloud infrastructure, virtualization and information security, technical, networking,platform system and cyber-security related topic.