Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get the node container in docker?

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

怎样获取docker中的节点容器?针对这个问题,今天小编总结这篇有关docker获取节点容器的文章,希望能帮助更多想解决这个问题的朋友找到更加简单易行的办法。

#!/bin/bash

#podName=$(docker inspect 847c1a42ba43 | awk -F "[ \"]*" '/"io.kubernetes.pod.name": / {print $4}'

podName(){

docker inspect $1 | awk -F "[ \"]*" '/"io.kubernetes.pod.name": / {print $4}'

}

podNamespace(){

docker inspect $1 | awk -F "[ \"]*" '/"io.kubernetes.pod.namespace": / {print $4}'

}

podDisk(){

diskName=$(docker inspect $1 | awk -F '[-"]*' '/"DeviceName"/ {print $(NF-1)}')

num=df -h | awk -F '[ /]' '$NF~diskName {print $(NF-7)}' diskName=${diskName} | grep -oP "\d{1,2}"

echo awk 'BEGIN{printf "%.2f\n",'$num'/'100'}'

}

end(){

echo podNamespace $1":"podName $1" "podDisk $1

}

for i in docker ps -q

do end $i

done

更多相关知识点内容:

如何获取每个节点上docker容器的运行状态

基于Docker快速搭建多节点Hadoop集群的示例

看完上述内容,你们掌握获取docker中的节点容器的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report