Public Repository

Last pushed: a year ago
Short Description
Centos 7 image with openssh-clients installed
Full Description

Centos 7 image with openssh-clients installed.

The following method explains how to use Dockered Centos 7 SSH for a specific set of IPs:

function ssh(){
    # Does not work with 
    local IPs="10.120.0.247 10.120.0.246"
    local _ssh="ssh"

    # store alias in case it exists
    if alias ssh > /dev/null 2>&1; then
        _ssh=$(alias ssh | cut -d "'" -f2)
    fi

    # No args: let it be and fail
    if [ $# = 0 ]; then
        $_ssh
        return 1
    fi

    # Iterate to get IP
    i=1
    while [ -n "${!i}" ] && [[ ! ${!i} =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; do
        let i=i+1
    done

    # If IP matches SSH from within Dockers' Centos 7
    for ip in $IPs; do
            if [[ ${!i} =~  $ip$ ]]; then
                echo "[SSH] docker"
                docker run --name centos7-ssh-huawei --rm -it olopopo/centos-ssh:latest ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${!i}
                return
            fi
    done
    command $_ssh $*
}
Docker Pull Command
Owner
olopopo

Comments (0)