Skip to content

Instantly share code, notes, and snippets.

@usmanismail
Created March 19, 2015 16:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save usmanismail/e8b93fb0253ec84fcdf6 to your computer and use it in GitHub Desktop.
Save usmanismail/e8b93fb0253ec84fcdf6 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