Skip to main content

Adds docker-machine ssh configuration into your personal ssh configuration

Project description

DOCKER-MACHINE ADD SSH

PyPi AUR

This is a command line program to allow you to use ordinary ssh commands with Docker Machine rather than use docker-machine ssh or docker-machine scp.

USAGE

usage: docker-machine-add-ssh [-h] [-r] [-d] [-f] [-B] [-S] name

Adds docker-machine ssh configuration to your personal ssh configuration.
Normally, you ssh to a docker-machine using command "docker-machine ssh
<mach>" but after running this utility once for the specified machine, you can
then on use ssh in the normal way, e.g. "ssh <mach>". Other standard programs
such as scp, sftp, rsync, and anything else that relies on them or normal ssh
can then also be used to that docker-machine.

positional arguments:
  name            docker machine name

optional arguments:
  -h, --help      show this help message and exit
  -r, --replace   do not fail if host entry already exists, just replace it
  -d, --delete    just delete any existing host entry
  -f, --files     get parameters directly from files rather than via docker-
                  machine command
  -B, --nobackup  do not create a backup file
  -S, --nostrict  disable strict host key check

Note you can set default starting arguments in ~/.config/docker-machine-add-
ssh-flags.conf.

See the latest documentation and code at https://github.com/bulletmark/docker-machine-add-ssh/.

EXAMPLES

$ tree foodir
foodir
├── a
└── b

# Create a docker machine:
$ docker-machine create vb1
...

# Login to that machine:
$ docker-machine ssh vb1
...
exit

# Copy a directory and it's files to the new machine the docker-machine way:
$ docker-machine scp -r foodir vb1:
b             100$    0     0.0KB/s   00:00
a             100%    0     0.0KB/s   00:00

# Or, use docker-machine rsync mode:
$ docker-machine scp -r -d foodir vb1:
sending incremental file list
foodir/a
              0 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=1/3)
foodir/b
              0 100%    0.00kB/s    0:00:00 (xfr#2, to-chk=0/3)

# Instead, do all this normally, after executing docker-machine-add-ssh:
$ docker-machine-add-ssh vb1
vb1 entry added to /home/mark/.ssh/config.

# Login to that machine normally. Be sure to do this first time to clear
# the host check as seen in this example:
$ ssh vb1
The authenticity of host '192.168.99.100 (192.168.99.100)' can't be established.
ECDSA key fingerprint is SHA256:Gya8jUcRhXlO/IkkTicrbLEPmMV0V5uOALB2Y5kJUCc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.99.107' (ECDSA) to the list of known hosts.

docker@vb1:~$ exit

# Now you can just use normal scp or rsync:
$ scp -pr foodir vb1:
b             100%    0     0.0KB/s   00:00    
a             100%    0     0.0KB/s   00:00 

$ rsync -av foodir vb1:
sending incremental file list

sent 100 bytes  received 17 bytes  234.00 bytes/sec
total size is 0  speedup is 0.00

# Finished with the machine so delete all trace of it:
$ docker-machine rm vb1
About to remove vb1
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed vb1

$ docker-machine-add-ssh -d vb1
vb1 entry deleted from /home/mark/.ssh/config.

DEFAULT ARGUMENTS

You can add default arguments to a personal configuration file ~/.config/docker-machine-add-ssh-flags.conf. If that file exists then each line of arguments will be concatenated and automatically prepended to your docker-machine-add-ssh command line arguments. Comments in the file (i.e. starting with "#") are ignored.

This allow you to set default preferred starting arguments to docker-machine-add-ssh. Type docker-machine-add-ssh -h to see the arguments supported. E.g. echo "-r" >~/.config/docker-machine-add-ssh-flags.conf to make docker-machine-add-ssh always replace existing host entries even if they already exist.

INSTALLATION

Ensure docker-machine is installed.

Arch users can install docker-machine-add-ssh from the AUR.

Python 3.7 or later is required. Note docker-machine-add-ssh is on PyPI so just ensure that python3-pip and python3-wheel are installed then type the following to install (or upgrade):

$ sudo pip3 install -U docker-machine-add-ssh

Alternately, do the following to install from the source repository.

$ git clone http://github.com/bulletmark/docker-machine-add-ssh
$ cd docker-machine-add-ssh

# Install globally ..
$ sudo pip3 install -U .

# Or, install for yourself only ..
$ pip3 install -U .

UPGRADE

$ cd docker-machine-add-ssh  # Source dir, as above
$ git pull

$ sudo pip3 install -U .
# Or, pip3 install -U .

REMOVAL

$ sudo pip3 uninstall docker-machine-add-ssh
# Or, pip3 uninstall docker-machine-add-ssh

LICENSE

Copyright (C) 2020 Mark Blakeney. This program is distributed under the terms of the GNU General Public License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses/ for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docker-machine-add-ssh-1.7.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

docker_machine_add_ssh-1.7-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file docker-machine-add-ssh-1.7.tar.gz.

File metadata

  • Download URL: docker-machine-add-ssh-1.7.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5

File hashes

Hashes for docker-machine-add-ssh-1.7.tar.gz
Algorithm Hash digest
SHA256 ebdded1080b1cbb78647ad147d1684c46e3e62b1633fc96871eb70ef2a4e9719
MD5 864566539361e3a6ca796533723a5652
BLAKE2b-256 38bd331198134939739fb47a07125bcf68bc13c4ccd7dc953bcd742a03fa830f

See more details on using hashes here.

File details

Details for the file docker_machine_add_ssh-1.7-py3-none-any.whl.

File metadata

  • Download URL: docker_machine_add_ssh-1.7-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5

File hashes

Hashes for docker_machine_add_ssh-1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9f705c937b51ba0d905871179197a53f9831cde5db40ca63598aa98d79f4a9bc
MD5 e24ed89e81df54a66a64d099af46bab6
BLAKE2b-256 2fef2e294734c60524e9698b7ba94544096cc228ef731ecf16f142b827983fe8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page