Skip to content

Latest commit

 

History

History

ssh_connection

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Using -Docker Client via SSH Example

Prerequisites:

For Windows 10:

Background

The Python Docker library establishes a SSH connection with public-key authentication, thus no password should be prompted from the server.

If you have not dealt with SSH before watch the video here to understand the basics of SSH connections.

For Windows 10:

Install the prerequisite software before continuing. If you already have OpenSSH installed on your Windows machine, it would not be necessary to install Git For Windows If you have not created a .ssh folder then create one at /%username%/.ssh. This is where your private and public key should be located. The reason I use PuTTY is because it has a component/program called Pagent, which Paramiko (the library used for SSH'ing in the Docker Client) to act as the SSH agent. For safety and simplicity one should generate private and public key with PuTTYgen. When I asked for a passphrase I left it empty. Did not test with a passphrase yet. When you have generated your private and public key, save them in the /%username%/.ssh folder As shown in the screenshot the text within the red block should be copied onto your Linux-based server into a file called authorized_keys located at ~/%remote_user%/.ssh/. PuTTYGen

If you installed Git For Windows, you can launch Git Bash or else Command Prompt. Type in: ssh %remote_user%@%remote_host% For example: ssh [email protected]

If connection is established it would prompt the following: unknown_host

If you type in 'yes', then it will create an public key entry in /%username%/.ssh/known_hosts file. It will from now on always trust the host.

If your public-key authentication is setup correctly on your server (the server where the Docker Daemon is running), then it won't prompt for a password anymore and use your public key to authenticate.

If this is not the case then some settings needs to be checked still. For Ubuntu Linux, see here

I am at this point still busy figuring out how to SSH to a Docker Daemon using the Python Docker library. The above-mentioned text is just some stuff I picked up, which is not very clearly documented anywhere.

Any feedback is more than welcome :)