如何检查泊坞主机是否处于群集模式?

前端之家收集整理的这篇文章主要介绍了如何检查泊坞主机是否处于群集模式?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

执行后;

eval $(docker-machine env mymachine)

如何检查mymachine上的docker守护进程是否是一个swarm管理器?

最佳答案
我目前没有方便的swarm节点,但看起来你可以简单地运行像docker node ls这样的东西.当定位不在swarm节点中的docker守护程序时,会导致:

Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

并返回非零退出代码

$echo $?
1

所以测试看起来像:

if docker node ls > /dev/null 2>&1; then
  echo this is a swarm node
else
  echo this is a standalone node
fi
原文链接:https://www.f2er.com/docker/436204.html

猜你在找的Docker相关文章