Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh connection #447

Open
bubodlack opened this issue Sep 8, 2016 · 3 comments
Open

ssh connection #447

bubodlack opened this issue Sep 8, 2016 · 3 comments

Comments

@bubodlack
Copy link

Can i connect to socket to remote server with ssh connection?

@TonyRogers
Copy link

I currently use docker-machine to interract with remote containers. This uses ssh.

I would like to use the same ssh connections with docker-api. Is this possible? I haven't got http/s exposed.

@patrick-motard
Copy link

patrick-motard commented Mar 4, 2020

It's supported by docker (documentation link). Example:

With a host defined in my ~/.ssh/config called myhost:

docker -H ssh://myhost ps

or

export DOCKER_HOST=ssh://myhost
docker ps

Either of the examples above will connect to the remote docker daemon over ssh.

I can't get this working in ruby via docker-api:

$> echo $DOCKER_HOST             
ssh://myhost
$> irb
irb(main):001:0> require 'docker'
=> true
irb(main):002:0> Docker.url
=> "ssh://myhost"
irb(main):003:0> Docker.info
Traceback (most recent call last):
       16: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/base.rb:17:in `error_call'
       15: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/idempotent.rb:50:in `error_call'
       14: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/connection.rb:275:in `request'
       13: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/base.rb:22:in `request_call'
       12: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/base.rb:22:in `request_call'
       11: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/base.rb:22:in `request_call'
       10: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/idempotent.rb:19:in `request_call'
        9: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/instrumentor.rb:34:in `request_call'
        8: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/mock.rb:57:in `request_call'
        7: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/middlewares/redirect_follower.rb:15:in `request_call'
        6: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/connection.rb:116:in `request_call'
        5: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/connection.rb:465:in `socket'
        4: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/connection.rb:465:in `new'
        3: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/socket.rb:47:in `initialize'
        2: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/socket.rb:119:in `connect'
        1: from /Users/pmotard/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/excon-0.72.0/lib/excon/socket.rb:119:in `getaddrinfo'
Excon::Error::Socket (getaddrinfo: nodename nor servname provided, or not known (SocketError))
irb(main):004:0> 

@Serhiy-Nazarov
Copy link

hello there!
Is it possible now to connect to the remote server with ssh connection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants