执行后;
eval $(docker-machine env mymachine)
如何检查mymachine上的docker守护进程是否是一个swarm管理器?
执行后;
eval $(docker-machine env mymachine)
如何检查mymachine上的docker守护进程是否是一个swarm管理器?
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