config/bash/docker-remote.sh

13 lines
379 B
Bash

# A simple aliasing tool for performing remote docker operations over ssh
# Usage: dcontrol <somehost.com>
# Assumes you have key-based root login
function dcontrol() {
if [ -z $1 ] || [ $1 == "off" ]; then
unalias docker 2> /dev/null
unset DOCKER_HOST
return
fi
export DOCKER_HOST=$1
alias docker="docker -H ssh://root@${DOCKER_HOST}"
}