Created
January 22, 2020 20:02
-
-
Save bahamat/5618260f3743d5d5261d4389e35085a9 to your computer and use it in GitHub Desktop.
Raw docker test utility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -x | |
| set -o pipefail | |
| api_v="1.21" | |
| call_docker() { | |
| local uuid=$(uuid) | |
| /opt/pkg/bin/curl -k -si \ | |
| --cert ${DOCKER_CERT_PATH}/cert.pem \ | |
| --key ${DOCKER_CERT_PATH}/key.pem \ | |
| --cacert ${DOCKER_CERT_PATH}/ca.pem \ | |
| -H "x-request-id: $uuid" \ | |
| https${DOCKER_HOST/tcp}/v${api_v}${1} | json | |
| } | |
| case $1 in | |
| ps) call_docker '/containers/json?all=true' ;; | |
| images) call_docker '/images/json?all=true';; | |
| info) call_docker '/info';; | |
| raw) call_docker "$2";; | |
| *) echo "not implemented"; exit 1;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment