Toolbox - The CLI Swiss Army Knife

Michael Delzer Updated by Michael Delzer

Toolbox is a Docker image that contains all tools installed and pre-configured to execute SuperHub operations via Hub CLI. It is based on Alpine linux for Docker container.

Several Toolbox versions are published on Dockerhub

The following is an image name for the stable Toolbox version: docker.io/agilestacks/toolbox:stable

Docker hub image Version Image Name Description
agilestacks/toolbox stable docker.io/agilestacks/toolbox:stable Latest validated image for Production deployments
agilestacks/toolbox preview docker.io/agilestacks/toolbox:preview Beta testing
agilestacks/toolbox latest docker.io/agilestacks/toolbox:latest Latest build of toolbox. Best for Dev environments

Tools Used

This image contains these (and many other) tools:

Tool Version Brief
aws-cli latest
Terraform v0.9.11 and 0.11.2 Location” /opt/terraform*; Default v0.9.11
hal v0.35 Spinnaker. Lazy loaded
helm latest for Kubernetes Helm
vault 0.9.0
git edge
direnv 2.13.1
docker latest Docker inside docker. Docker daemon lazy loaded. Must run --privileged=true to use docker

Installing Toolbox

The User can download and run Toolbox on MacOs or Linux hosts using the following script: toolbox-run

#!/bin/sh -e

if test -z "$USER"; then
echo USER is not set
exit 1
fi

if test -z "$HOME"; then
echo HOME is not set
exit 1
fi

BASEDIR="$(pwd)"
if test "$BASEDIR" = "/"; then
echo "Toolbox doesn't support '/' as current directory"
exit 1
fi

TOOLBOX_SHELL=${TOOLBOX_SHELL:-/bin/bash}
IMAGE=${IMAGE:-agilestacks/toolbox}
IMAGE_VERSION=${IMAGE_VERSION:-stable}

if test -z "${AWS_PROFILE}" && \
test -x "$(which aws)" && \
aws sts get-caller-identity > /dev/null 2>&1; then
AWS_PROFILE=$(aws configure list | awk '$1 ~ /^profile$/ {print $2}')
export AWS_PROFILE
fi

envfile=$(mktemp)
env | grep -E '^(AWS_|GOOGLE_|AZURE_|TF_|TERM=|LANG=|LC_)' >"$envfile"
envadd=""
if test -s "$envfile"; then
envadd="--env-file $envfile"
fi

docker_config=$HOME/.docker/config.json
if test -f $docker_config && grep osxkeychain $docker_config >/dev/null; then
pruned_docker_config=$(mktemp /tmp/docker.json.XXXXXX)
sed -e 's/osxkeychain//g' $docker_config > $pruned_docker_config
maybe_docker_config="-v $pruned_docker_config:$HOME/.docker/config.json"
fi

# no pull if version is based on commit hashes
if test -n "$(echo $IMAGE_VERSION | sed -E -e 's/[0-9a-f]{7}-[0-9a-f]{7}//')"; then
docker pull "$IMAGE:$IMAGE_VERSION" 2>/dev/null || true
fi
docker run -ti --rm \
-h toolbox-"$(tty|sed -e 's|/dev/||')" \
-e TMPDIR=/tmp \
-e "USER=$USER" \
-e "UID=$(id -u)" \
-e "GID=$(id -g)" \
-e "HOME=$HOME" \
-e "SHELL=${TOOLBOX_SHELL}" \
-e 'PS1=\u@\e[92m\h\e[0m \w $ ' \
-v "$HOME:$HOME" \
-v "$BASEDIR:$BASEDIR" \
$maybe_docker_config \
--privileged=true \
--cap-add=NET_ADMIN \
-w "$BASEDIR" \
$envadd \
"$IMAGE:$IMAGE_VERSION" "$@"
echo "Shutting down toolbox... bye!"

rm -f $envfile $pruned_docker_config

How did we do?

Templating

Authenticate to SuperHub

Contact