docker / docker/docker-py

dockerpy fails with ssh if remote machine was not added to hosts

Open
#2,398 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

This could be avoided by doing ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) before as mentioned on https://github.com/onyxfish/relay/issues/11#issuecomment-26494294

INTERNALERROR>   File "/root/rdo/ansible-role-container-registry/.tox/molecule/lib/python3.6/site-packages/docker/client.py", line 40, in __init__
INTERNALERROR>     self.api = APIClient(*args, **kwargs)
INTERNALERROR>   File "/root/rdo/ansible-role-container-registry/.tox/molecule/lib/python3.6/site-packages/docker/api/client.py", line 166, in __init__
INTERNALERROR>     base_url, timeout, pool_connections=num_pools
INTERNALERROR>   File "/root/rdo/ansible-role-container-registry/.tox/molecule/lib/python3.6/site-packages/docker/transport/sshconn.py", line 84, in __init__
INTERNALERROR>     self._connect()
INTERNALERROR>   File "/root/rdo/ansible-role-container-registry/.tox/molecule/lib/python3.6/site-packages/docker/transport/sshconn.py", line 94, in _connect
INTERNALERROR>     parsed.hostname, parsed.port, parsed.username,
INTERNALERROR>   File "/root/rdo/ansible-role-container-registry/.tox/molecule/lib/python3.6/site-packages/paramiko/client.py", line 416, in connect
INTERNALERROR>     self, server_hostkey_name, server_key
INTERNALERROR>   File "/root/rdo/ansible-role-container-registry/.tox/molecule/lib/python3.6/site-packages/paramiko/client.py", line 824, in missing_host_key
INTERNALERROR>     "Server {!r} not found in known_hosts".format(hostname)
INTERNALERROR> paramiko.ssh_exception.SSHException: Server 'n0' not found in known_hosts

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in docker/transport/sshconn.py at the _connect() call shown in the traceback, and review how the Paramiko client handles hosts absent from known_hosts. Compare the proposed missing-host-key behavior with the linked discussion and verify that SSH connections to an unregistered remote host complete without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.