README
This is a 90% fork of Harbor-master from arhea
The 10% are dedicated to bug correction
Harbor Master
Harbor Master is a Docker Remote API client written in Node. This client is meant to be a simple wrapper that makes it easy to communicate with your Docker Daemon over the unix socket or http based APIs.
This project is still in active development. This project will be versioned in accordance with the Docker Remote API. For example, if the current Docker Remote API version is 1.32
, Harbor Master's version will be 1.32.x
.
Table of Contents
Examples
Unix Socket Example
const docker = require('../index');
const client = docker.Client({
socket: '/var/run/docker.sock'
});
client.info().then((info) => {
console.log(info);
}).catch((err) => {
console.error(err);
});
Remote Host Example
const docker = require('../index');
const client = docker.Client({
host: 'swarm.example.com',
port: '2375'
});
client.info().then((info) => {
console.log(info);
}).catch((err) => {
console.error(err);
});
SSL Configuration
const docker = require('../index');
const client = docker.Client({
host: 'swarm.example.com',
port: '2376',
tls: {
ca: fs.readFileSync('ca.pem'),
cert: fs.readFileSync('cert.pem'),
key: fs.readFileSync('key.pem'),
passphrase: 'supersecretpass'
}
});
client.info().then((info) => {
console.log(info);
}).catch((err) => {
console.error(err);
});
API Documentation
- Harbor Master Client docker.Client(options)
options
host
- the IP address or Hostname of the Docker serverport
- the port number the Docker server exposessocket
- the unix sockettls
cert
- contents of the server certificatekey
- contents of the server certificate keyca
- contents of the CA certificatepassword
- the certificate password
Configs
- List Configs client.configs().list(options)
- Docker Documentation
options
filters
-map[string][]string
to process on the configs list
- Create Config client.configs().create(model, options)
- Docker Documentation
model
- the JSON model that the Docker API consumesoptions
- Inspect Config client.configs().inspect(id, options)
- Docker Documentation
id
- the id or name of the configoptions
- Remove Config client.configs().remove(id, options)
- Docker Documentation
name
- the id of the configoptions
- Update Config client.configs().update(id, model, options)
- Docker Documentation
id
- the id or name of the configmodel
- the JSON model that the Docker API consumesoptions
version
- The version number of the config object being updated. This is required to avoid conflicting writes.
Containers
- List Containers client.containers().list(options)
- Docker Documentation
options
all
- default:false
Show all containers. Only running containers are shown by default.limit
- Show limit last created containers, include non-running ones.since
- Show only containers created since Id, include non-running ones.before
- Show only containers created before Id, include non-running ones.size
- default:false
Show the containers sizesfilters
-map[string][]string
to process on the containers list
- Create Container client.containers().create(model, options)
- Docker Documentation
model
- the JSON model that the Docker API consumesoptions
name
- Assign the specified name to the container. Must match/?[a-zA-Z0-9_-]+
.
- Inspect Container client.containers().inspect(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
size
- default:false
Show the containers sizes
- List Processes Running Inside a Container client.containers().top(name)
- Docker Documentation
name
- the name or id of the containeroptions
ps_args
-ps
arguments to use (e.g., aux), defaults to-ef
- Container Logs client.containers().logs(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
details
- Show extra details provided to logs. default:false
follow
- return stream. default:false
stdout
- show stdout log. default:false
stderr
- show stderr log. default:false
since
- Specifying a timestamp will only output log-entries since that timestamp. default:false
timestamps
- print timestamps for every log line default:false
tail
- Output specified number of lines at the end of logs: all ordefault: all
- Inspect Container Filesystem Changes client.containers().changes(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
- Export a Container client.containers().export(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
- Export a Container client.containers().stats(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
stream
- stream statistics default:true
- Resize a container TTY client.containers().resize(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
h
- heightw
- width
- Start a Container client.containers().start(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
detachKeys
- Override the key sequence for detaching a container. Format is a single character.
- Stop a Container client.containers().stop(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
t
- number of seconds to wait before killing the container
- Restart a Container client.containers().restart(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
t
- number of seconds to wait before killing the container
- Kill a Container client.containers().kill(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
signal
- Signal to send to the container: integer or string like SIGINT. When not set, SIGKILL is assumed and the call waits for the container to exit.
- Update a Container client.containers().update(name, model, options)
- Docker Documentation
name
- the name or id of the containermodel
- the JSON model that the Docker API consumesoptions
- Rename a Container client.containers().rename(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
name
- new name for the container
- Pause a Container client.containers().pause(name)
- Docker Documentation
name
- the name or id of the containeroptions
- Unpause a Container client.containers().unpause(name)
- Docker Documentation
name
- the name or id of the containeroptions
- Attach a Container client.containers().attach(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
detachKeys
- Override the key sequence for detaching a container. Format is a single characterlogs
- return logs default:false
stream
- return stream default:false
stdin
- return stdin default:false
stdout
- return stdout default:false
stderr
- return stderr default:false
- Wait a Container client.containers().unpause(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
- Wait a Container client.containers().remove(name, options)
- Docker Documentation
name
- the name or id of the containeroptions
v
- Remove the volumes associated to the container default:false
force
- Kill then remove the container default:false
Images
- Wait a Container client.images().list(options)
- Docker Documentation
options
filters
-map[string][]string
to process on the images list
- Build an Image From a Dockerfile client.images().build(stream, options, registryAuth)
- Docker Documentation
options
+registryAuth
username
password
serveraddress
- Create Image client.images().create(options, registryAuth)
- Docker Documentation
options
fromImage
fromSrc
repo
q
tag
registryAuth
username
password
serveraddress
- Inspect an Image client.images().inspect(name, options)
- Docker Documentation
name
- the name or id of the imageoptions
- History of an Image client.images().history(name, options)
- Docker Documentation
name
- the name or id of the imageoptions
- Push an Image on the Registry client.images().push(name, options, registryAuth)
- Docker Documentation
name
- the name or id of the imageoptions
tag
registryAuth
username
password
serveraddress
- Tag an Image client.images().tag(name, options)
- Docker Documentation
name
- the name or id of the imageoptions
repo
tag
- Remove of Image client.images().remove(name, options)
- Docker Documentation
name
- the name or id of the imageoptions
repo
tag
- Search Images client.images().search(options)
- Docker Documentation
name
- the name or id of the imageoptions
term
limit
filters
Networks
- List Networks client.networks().list(options)
- Docker Documentation
options
filters
- JSON encoded network list filter.
- Create a Network client.networks().create(model, options)
- Docker Documentation
model
- a json model representing the networkoptions
- Inspect a Network client.networks().inspect(id, options)
- Docker Documentation
id
- the network id or nameoptions
- Remove a Network client.networks().remove(id, options)
- Docker Documentation
id
- the network id or nameoptions
- Connect a Container to a Network client.networks().connect(id, options)
- Docker Documentation
id
- the network id or nameoptions
- Disconnect a Container to a Network client.networks().disconnect(id, options)
- Docker Documentation
id
- the network id or nameoptions
Nodes
- List Nodes client.nodes().list(options)
- Docker Documentation
id
- the node idoptions
filters
- JSON encoded node list filter.
- Inspect a Node client.nodes().inspect(id, options)
- Docker Documentation
id
- the node idoptions
- Remove a Node client.nodes().remove(id, options)
- Docker Documentation
id
- the node idoptions
- Update A Node client.nodes().update(id, options)
- Docker Documentation
id
- the node idoptions
version
- The version number of the node object being updated. This is required to avoid conflicting writes.
Plugins
- List Plugins client.plugins().list(options)
- Docker Documentation
options
filters
- a JSON encoded value of the filters (a map[string][]string) to process on the services list.
- Install a Plugin client.plugins().install(options)
- Docker Documentation
options
name
- Name of the plugin to pull. The name may include a tag or digest. This parameter is required.
- Inspect a Plugin client.plugins().inspect(id, options)
- Docker Documentation
options
- Enable a Plugin client.plugins().enable(id, options)
- Docker Documentation
options
- Disable a Plugin client.plugins().disable(id, options)
- Docker Documentation
options
- Remove a Plugin client.plugins().remove(id, options)
- Docker Documentation
options
Services
- List Services client.services().list(options)
- Docker Documentation
options
filters
- a JSON encoded value of the filters (a map[string][]string) to process on the services list.
- Create a Service client.services().create(options, registryAuth)
- Docker Documentation
options
- Remove a Service client.services().remove(id, options)
- Docker Documentation
id
- id or name of the serviceoptions
- Inspect a Service client.services().inspect(id, options)
- Docker Documentation
id
- id or name of the serviceoptions
- Get Service Logs client.services().logs(id, options)
- Docker Documentation
id
- id or name of the serviceoptions
details
- boolean, Show extra details provided to logs.follow
- boolean, Return the logs as a stream.stdout
- boolean, Return logs from stdoutstderr
- boolean, Return logs from stderrsince
- number, Only return logs since this time, as a UNIX timestamptimestamps
- boolean, Add timestamps to every log linetail
- Only return this number of log lines from the end of the logs. Specify as an integer or all to output all log lines.
- Update a Service client.services().update(id, options, registryAuth)
- Docker Documentation
id
- id or name of the serviceoptions
version
- The version number of the service object being updated. This is required to avoid conflicting writes.
Swarm
- Swarm Info client.swarm().info(options)
- Docker Documentation
options
- Initialize a Swarm client.swarm().init(options)
- Docker Documentation
options
- Join a Swarm client.swarm().join(options)
- Docker Documentation
options
- Leave a Swarm client.swarm().leave(options)
- Docker Documentation
options
force
- Boolean (false/true). Force leave swarm, even if this is the last manager or that it will break the cluster.
- Update a Swarm client.swarm().update(options)
- Docker Documentation
options
version
- The version number of the swarm object being updated. This is required to avoid conflicting writes.rotateWorkerToken
- Set to true to rotate the worker join token.rotateManagerToken
- Set to true to rotate the manager join token.
Tasks
- List Services client.tasks().list(options)
- Docker Documentation
options
filters
- a JSON encoded value of the filters (a map[string][]string) to process on the tasks list.
- Inspect a Task client.tasks().inspect(id, options)
- Docker Documentation
options
Volumes
- List Volumes client.volumes().list(options)
- Docker Documentation
options
filters
- a JSON encoded value of the filters (a map[string][]string) to process on the volumes list.
- Create a Volume client.volumes().create(options, registryAuth)
- Docker Documentation
id
or name of the volumeoptions
- Remove a Volume client.volumes().remove(id, options)
- Docker Documentation
id
or name of the volumeoptions
- Inspect a Volume client.volumes().inspect(id, options)
- Docker Documentation
id
or name of the volumeoptions
Secrets
- List Secret client.secrets().list(options)
- Docker Documentation
options
filters
-map[string][]string
to process on the secrets list
- Create Secret client.secrets().create(model, options)
- Docker Documentation
model
- the JSON model that the Docker API consumesoptions
- Inspect Secret client.secrets().inspect(id, options)
- Docker Documentation
id
- the id or name of the secretoptions
- Remove Secret client.secrets().remove(id, options)
- Docker Documentation
name
- the id of the secretoptions
- Update Secret client.secrets().update(id, model, options)
- Docker Documentation
id
- the id or name of the secretmodel
- the JSON model that the Docker API consumesoptions
version
- The version number of the secret object being updated. This is required to avoid conflicting writes.
Daemon
- System Wide Information client.info()
- Authentication Configuration client.auth(options)
- Docker Documentation
options
username
password
serveraddress
- Version client.version()
- Ping Daemon client.ping()
- Events Stream client.events()
- Docker Documentation
options
since
- Timestamp. Show all events created since timestamp and then streamuntil
- Timestamp. Show events created until given timestamp and stop streamingfilters
- value of the filters (a map[string][]string) to process on the event list