apocas / docker-modem

Docker Remote API network stack driver.
Apache License 2.0
234 stars 112 forks source link

Add ssh protocol support. #102

Closed x13machine closed 5 years ago

x13machine commented 5 years ago

Currently, I have so it creates a new ssh connection on every request. Do you think the ssh connection should persist? So you think it should be an option?

Example:

var Docker = require("dockerode");
var fs = require('fs');
var key = fs.readFileSync('/path/to/ssh-key');

var docker = new Docker({
    protocol: 'ssh',
    host: 'localhost',
    ssh: {
        privateKey: key,
        username: 'root'
    }
});

docker.listImages((e,d) => {
    console.log('img', e, d);
});

docker.info((e,d) => {
    console.log('con', e, d);
});

fixes #99

apocas commented 5 years ago

I think it's better for it to be an option. If someone wants persistent connections it will be able to specify it.

Awesome and much needed PR :)