Skip to content

Support OpenSSH's IdentityFile config option #2533

@HaaLeo

Description

@HaaLeo

Description

As a developer I want docker-py to load the identity file according to my setting specified in ~/.ssh/config, not only the "default" id_rsa file.

Example

I have a ~/.ssh/config file with contents:

Host myHost
    User myUser
    HostName myIp
    IdentityFile C:/Users/me/.ssh/id_rsa_custom_file
    IdentitiesOnly yes

Now I would like docker-py to pick up C:/Users/me/.ssh/id_rsa_custom_file for trying to connect to the remote host (For example when I want to run docker-compose -H "ssh://myHost" ps. However right now it does not.

When I rename C:/Users/me/.ssh/id_rsa_custom_file to C:/Users/me/.ssh/id_rsa it works just fine. However this is not an option for me since I have multiple identity files and hosts that I want to use.

Proposal

Add something like this to the sshcon.py:

if 'identityfile' in host_config:
    self.ssh_params['key_filename '] = host_config['identityfile']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions