Skip to content

Instantly share code, notes, and snippets.

@rsmartins78
Forked from usmanismail/rancher-get-info.sh
Created April 12, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsmartins78/b7121ac5dfc7bbb1c1d062804c2ee641 to your computer and use it in GitHub Desktop.
Save rsmartins78/b7121ac5dfc7bbb1c1d062804c2ee641 to your computer and use it in GitHub Desktop.
A curl wrapper to get container info from the rancher API
#!/bin/sh
usage(){
echo "Usage: $0 ACCESS_KEY ACCESS_SECRET CONATAINER_ID"
exit 1
}
# call usage() function if filename not supplied
[[ $# -ne 3 ]] && usage
ACCESS_KEY=$1
ACCESS_SECRET=$2
CONTAINER_ID=$3
curl -s -u "${ACCESS_KEY}:${ACCESS_SECRET}" -X Get \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
"http://rancher.maluuba.com:34080/v1/containers/${CONTAINER_ID}" | python -m json.tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment