项目作者: apocas

项目描述 :
Docker Remote API network stack driver.
高级语言: JavaScript
项目地址: git://github.com/apocas/docker-modem.git
创建时间: 2013-12-01T16:22:46Z
项目社区:https://github.com/apocas/docker-modem

开源协议:Apache License 2.0

下载


docker-modem

Docker‘s Remote API network layer module.

docker-modem will help you interacting with Docker, since it already implements all the network strategies needed to support all Docker‘s Remote API endpoints.

It is the module powering (network wise) dockerode and other modules.

Usage

Getting started

  1. var Modem = require('docker-modem');
  2. var modem1 = new Modem({socketPath: '/var/run/docker.sock'});
  3. var modem2 = new Modem(); //defaults to above if env variables are not used
  4. var modem3 = new Modem({host: 'http://192.168.1.10', port: 3000});
  5. var modem4 = new Modem({protocol:'http', host: '127.0.0.1', port: 3000});
  6. var modem5 = new Modem({host: '127.0.0.1', port: 3000}); //defaults to http

SSH

You can connect to the Docker daemon via SSH in two ways:

  • Using the built-in SSH agent.
  • Implement your own custom agent.
  1. //built-in SSH agent
  2. var modem1 = new Modem({
  3. protocol: 'ssh',
  4. host: 'ssh://127.0.0.1',
  5. port: 22
  6. });
  7. //custom agent
  8. var customAgent = myOwnSSHAgent({host: 'ssh://127.0.0.1', port: 22});
  9. var modem2 = new Modem({
  10. agent: customAgent,
  11. });

Tests

  • Tests are implemented using mocha and chai. Run them with npm test.
  • Check dockerode tests, which is indirectly co-testing docker-modem.

Sponsors

Amazing entities that sponsor my open-source work. Check them out!

HTTP Toolkit

License

Pedro Dias - @pedromdias

Licensed under the Apache license, version 2.0 (the “license”); You may not use this file except in compliance with the license. You may obtain a copy of the license at:

http://www.apache.org/licenses/LICENSE-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an “as is” basis, without warranties or conditions of any kind, either express or implied. See the license for the specific language governing permissions and limitations under the license.