sh ?为docker-machine中的所有机器调用Docker Remote API

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh ?为docker-machine中的所有机器调用Docker Remote API相关的知识,希望对你有一定的参考价值。

#!/bin/bash -eu
#
# Call Docker Remote API for all machines in docker-machine.
#

get() {
  local node=$1
  local path=$2

  declare ip=$(docker-machine ip $node)
  declare cert_path=$MACHINE_STORAGE_PATH/machines/$node

  curl -sk --cert $cert_path/cert.pem --key $cert_path/key.pem \
    https://$ip:2376/$path
}

list() {
  local path=$1
  while read node; do
    get $node $path | jq .[] &
  done < <(docker-machine ls -q)
  wait
}

list containers/json | jq -s .

以上是关于sh ?为docker-machine中的所有机器调用Docker Remote API的主要内容,如果未能解决你的问题,请参考以下文章