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.

Documentation: How to use ssh connection

See original GitHub issue

Hi,

thank you very much for starting this nice package.

Could you please provide one example that shows how to execute the commands on a remote host? I’ve tried to set host=‘ssh://user@ip’, unfortunately without success (the host runs docker and is accessible, validated via docker-py). Connecting to the local machine seems to work.

client = DockerClient(
    config=client_config,
    context=None,
    debug=None,
    host='ssh://user@ip',
    log_level=None,
    tls=None,
    tlscacert=None,
    tlscert=None,
    tlskey=None,
    tlsverify=None,
    client_config=None,
    compose_files=[],
)
client.info()
ValidationError: 53 validation errors for SystemInfo
ID
  field required (type=value_error.missing)
Containers
  field required (type=value_error.missing)
ContainersRunning
  field required (type=value_error.missing)
ContainersPaused
  field required (type=value_error.missing)
ContainersStopped
  field required (type=value_error.missing)
Images
  field required (type=value_error.missing)
Driver
  field required (type=value_error.missing)
DriverStatus
  field required (type=value_error.missing)
DockerRootDir
  field required (type=value_error.missing)
Plugins
  field required (type=value_error.missing)
MemoryLimit
  field required (type=value_error.missing)
SwapLimit
  field required (type=value_error.missing)
KernelMemory
  field required (type=value_error.missing)
CpuCfsPeriod
  field required (type=value_error.missing)
CpuCfsQuota
  field required (type=value_error.missing)
CPUShares
  field required (type=value_error.missing)
CPUSet
  field required (type=value_error.missing)
PidsLimit
  field required (type=value_error.missing)
OomKillDisable
  field required (type=value_error.missing)
IPv4Forwarding
  field required (type=value_error.missing)
BridgeNfIptables
  field required (type=value_error.missing)
BridgeNfIp6tables
  field required (type=value_error.missing)
Debug
  field required (type=value_error.missing)
NFd
  field required (type=value_error.missing)
NGoroutines
  field required (type=value_error.missing)
SystemTime
  field required (type=value_error.missing)
LoggingDriver
  field required (type=value_error.missing)
CgroupDriver
  field required (type=value_error.missing)
NEventsListener
  field required (type=value_error.missing)
KernelVersion
  field required (type=value_error.missing)
OperatingSystem
  field required (type=value_error.missing)
OSType
  field required (type=value_error.missing)
Architecture
  field required (type=value_error.missing)
NCPU
  field required (type=value_error.missing)
MemTotal
  field required (type=value_error.missing)
IndexServerAddress
  field required (type=value_error.missing)
RegistryConfig
  field required (type=value_error.missing)
HttpProxy
  field required (type=value_error.missing)
HttpsProxy
  field required (type=value_error.missing)
NoProxy
  field required (type=value_error.missing)
Name
  field required (type=value_error.missing)
Labels
  field required (type=value_error.missing)
ExperimentalBuild
  field required (type=value_error.missing)
ServerVersion
  field required (type=value_error.missing)
Runtimes
  field required (type=value_error.missing)
DefaultRuntime
  field required (type=value_error.missing)
Swarm
  field required (type=value_error.missing)
LiveRestoreEnabled
  field required (type=value_error.missing)
Isolation
  field required (type=value_error.missing)
InitBinary
  field required (type=value_error.missing)
ContainerdCommit
  field required (type=value_error.missing)
RuncCommit
  field required (type=value_error.missing)
InitCommit
  field required (type=value_error.missing)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DF3AKcommented, Jun 16, 2021

It works, however only if I run ssh-add in the same shell before executing the docker command:

/usr/bin/docker --host ssh://user@xxx.xxx.xxx.xxx  container list -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                     PORTS     NAMES
0d9be03b17f5   debian         "bash"                   8 seconds ago   Exited (0) 6 seconds ago             nice_meitner
74d6c142d27d   e1b5b7b06862   "/bin/sh -c 'mkdir -…"   22 hours ago    Exited (0) 22 hours ago              interesting_pike
129ca9a96f0c   24682118fcbf   "/bin/sh -c '#(nop) …"   22 hours ago    Created                              elegant_sammet
3162d82a2cbe   730cce28d0c8   "/bin/sh -c 'apt-get…"   22 hours ago    Exited (0) 22 hours ago              laughing_pascal
ef37c788fb0f   6bba76b56108   "/bin/sh -c 'apt-get…"   22 hours ago    Exited (0) 22 hours ago              hopeful_bohr
22aefb133d5c   6e3fa18e7bf7   "/bin/sh -c '#(nop) …"   22 hours ago    Created                              strange_carver
07b19b09fc77   9b5e75b69a4f   "/bin/sh -c '#(nop) …"   22 hours ago    Created                              hungry_sanderson

Without ssh-add, I get

error during connect: Get http://docker/v1.24/containers/json?all=1: command [ssh -l user -- xxx.xxx.xxx.xxx docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
user@xxx.xxx.xxx.xxx: Permission denied (publickey,password).
0reactions
Smyjacommented, Jul 19, 2021

Hi @Smyja ! Do you manage to contact your server with the docker command line? Can you do something like:

docker --host ssh://user@xxx.xxx.xxx.xxx  container list

This would be a first step to make python-on-whales working over ssh.

Since python-on-whales is just a wrapper around the docker CLI, try to make the CLI work first. It’s easier to debug.

I get this error.

error during connect: Get http://docker/v1.24/containers/json: command [ssh -l root -- xxx.xx.xx.xx docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=Permission denied, please try again. I solved the error by running ssh-copy-id in my local pc root and setting the password authentication to yes. Now,when I run the command you sent it just keeps running.

i have tried everything, i believe there’s something wrong with the command. what exactly is the command supposed to do? because i am running it inside a vps. i do not have docker installed locally. This isn’t much of a problem, because remote connection actually works now. i raised another issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Developer's Guide to Start Using SSH (Connect to Your ...
Using SSH to access your WordPress site will make you a more efficient developer. Learn how to do it with this in-depth guide....
Read more >
SSH Essentials: Working with SSH Servers, Clients, and Keys
SSH, or secure shell, is the most common way of connecting to and administering remote Linux servers. In this cheat sheet-style guide, ...
Read more >
ssh command usage, options, and configuration in Linux/Unix.
This command is used to start the SSH client program that enables secure connection to the SSH server on a remote machine. The...
Read more >
Connecting to GitHub with SSH
You can connect to GitHub using the Secure Shell Protocol (SSH), which provides a secure channel over an unsecured network.
Read more >
SSH Access - cPanel & WHM Documentation
This interface provides information about how to connect to another web server via the SSH (secure shell) network protocol.
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