question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker Agent can't use SSH for --base-url

See original GitHub issue

Description

Docker Agent can’t connect to remote Docker daemon with SSH. It results in

Traceback (most recent call last):
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\docker\api\client.py", line 165, in __init__
    self._custom_adapter = SSHHTTPAdapter(
NameError: name 'SSHHTTPAdapter' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\tfh\Miniconda3\envs\prefect\Scripts\prefect-script.py", line 9, in <module>
    sys.exit(cli())
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\prefect\cli\agent.py", line 260, in start
    docker_interface=not no_docker_interface,
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\prefect\agent\docker\agent.py", line 117, in __init__
    self.docker_client = self._get_docker_client()
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\prefect\agent\docker\agent.py", line 142, in _get_docker_client
    return docker.APIClient(base_url=self.base_url, version="auto")
  File "C:\Users\tfh\Miniconda3\envs\prefect\lib\site-packages\docker\api\client.py", line 170, in __init__
    'Install paramiko package to enable ssh:// support'
docker.errors.DockerException: Install paramiko package to enable ssh:// support

Expected Behavior

That I could connect to docker host.

Reproduction

Simply run: prefect agent start docker --base-url ssh://mydockerhost

Environment

(prefect) λ prefect diagnostics { "config_overrides": { "backend": true, "server": { "endpoint": true, "graphql": { "host": true }, "host": true, "host_port": true, "port": true, "ui": { "endpoint": true, "graphql_url": true, "host": true, "host_port": true, "port": true } } }, "env_vars": [], "system_information": { "platform": "Windows-10-10.0.18362-SP0", "prefect_version": "0.11.5", "python_version": "3.7.0" } }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
joshmeekcommented, Jun 12, 2020

Thanks for opening @thomasfrederikhoeck! Will take a look at this. One thing, if you pip install paramiko then try running this again does it start working?

0reactions
lauralorenzcommented, Jul 2, 2020

Glad to see that you got it worked out 🎉 Closing this now that we got it figured out.

To follow up on your questions: on my windows machine, I have prefect installed via pip from pypi, and then also from my local source using pip; out of curiosity I also installed it just now in another environment using conda instead (and followed the same package manager, respectively, for when I installed paramiko). I didn’t experience the cryptography problems from any of the 3 situations.

All that being said, it is up to the user whether they install their dependencies using pip or conda. cryptography is a dependency of paramiko, not prefect (since docker chose not to make paramiko a hard dependency). If the speculation in that linked spacy google group is true and cryptography has issues with the Anaconda distro of python and pip, then it depends how the user install paramiko in particular if they will experience this issue with cryptography; and ultimately it is an upstream problem that is potentially best served by a ticket on the cryptography repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git - ssh-add in docker - Could not open a connection to your ...
I believe the issue related to ssh configuration in your container, the default ssh strategy in Ubuntu is to refuse the root remote...
Read more >
Installation with Docker - Docs
Mount /home/git/. ssh of the host into the container. This ensures that the authorized_keys file is shared between the host git user and...
Read more >
How to Fix “Cannot find a valid baseurl for repo” in CentOS
In this short article, we will show how to fix “cannot find a valid baseurl for repo” error in CentOS Linux distribution.
Read more >
How to Install Gitea on Ubuntu Using Docker - DigitalOcean
Because Gitea is running in a Docker container, it cannot accept SSH connections on the default port of 22 , as this will...
Read more >
Use SSH keys to communicate with GitLab
Docker · Helm chart · GitLab agent ... Use SSH certificates · Enable encrypted configuration ... Default domains, URLs, and baseurls.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found