1.32.1 • Published 8 years ago
harbor-master v1.32.1
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.24, Harbor Master's version will be 1.24.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
docker.Client(options) - Harbor Master Client
optionshost- the IP address or Hostname of the Docker serverport- the port number the Docker server exposessocket- the unix sockettlscert- contents of the server certificatekey- contents of the server certificate keyca- contents of the CA certificatepassword- the certificate password
Containers
client.containers().list(options) - List Containers
- Docker Documentation
optionsall- default:falseShow 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:falseShow the containers sizesfilters-map[string][]stringto process on the containers list
client.containers().create(model, options) - Create Container
- Docker Documentation
model- the JSON model that the Docker API consumesoptionsname- Assign the specified name to the container. Must match/?[a-zA-Z0-9_-]+.
client.containers().inspect(name, options) - Inspect Container
- Docker Documentation
name- the name or id of the containeroptionssize- default:falseShow the containers sizes
client.containers().top(name) - List Processes Running Inside a Container
- Docker Documentation
name- the name or id of the containeroptionsps_args-psarguments to use (e.g., aux), defaults to-ef
client.containers().logs(name, options) - Container Logs
- Docker Documentation
name- the name or id of the containeroptionsdetails- Show extra details provided to logs. default:falsefollow- return stream. default:falsestdout- show stdout log. default:falsestderr- show stderr log. default:falsesince- Specifying a timestamp will only output log-entries since that timestamp. default:falsetimestamps- print timestamps for every log line default:falsetail- Output specified number of lines at the end of logs: all or default:all
client.containers().changes(name, options) - Inspect Container Filesystem Changes
- Docker Documentation
name- the name or id of the containeroptions
client.containers().export(name, options) - Export a Container
- Docker Documentation
name- the name or id of the containeroptions
client.containers().stats(name, options) - Export a Container
- Docker Documentation
name- the name or id of the containeroptionsstream- stream statistics default:true
client.containers().resize(name, options) - Resize a container TTY
- Docker Documentation
name- the name or id of the containeroptionsh- heightw- width
client.containers().start(name, options) - Start a Container
- Docker Documentation
name- the name or id of the containeroptionsdetachKeys- Override the key sequence for detaching a container. Format is a single character.
client.containers().stop(name, options) - Stop a Container
- Docker Documentation
name- the name or id of the containeroptionst- number of seconds to wait before killing the container
client.containers().restart(name, options) - Restart a Container
- Docker Documentation
name- the name or id of the containeroptionst- number of seconds to wait before killing the container
client.containers().kill(name, options) - Kill a Container
- Docker Documentation
name- the name or id of the containeroptionssignal- 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.
client.containers().update(name, model, options) - Update a Container
- Docker Documentation
name- the name or id of the containermodel- the JSON model that the Docker API consumesoptions
client.containers().rename(name, options) - Rename a Container
- Docker Documentation
name- the name or id of the containeroptionsname- new name for the container
client.containers().pause(name) - Pause a Container
- Docker Documentation
name- the name or id of the containeroptions
client.containers().unpause(name) - Unpause a Container
- Docker Documentation
name- the name or id of the containeroptions
client.containers().attach(name, options) - Attach a Container
- Docker Documentation
name- the name or id of the containeroptionsdetachKeys- Override the key sequence for detaching a container. Format is a single characterlogs- return logs default:falsestream- return stream default:falsestdin- return stdin default:falsestdout- return stdout default:falsestderr- return stderr default:false
client.containers().unpause(name, options) - Wait a Container
- Docker Documentation
name- the name or id of the containeroptions
client.containers().remove(name, options) - Wait a Container
- Docker Documentation
name- the name or id of the containeroptionsv- Remove the volumes associated to the container default:falseforce- Kill then remove the container default:false
Images
client.images().list(options) - Wait a Container
- Docker Documentation
optionsfilters-map[string][]stringto process on the images list
client.images().build(stream, options, registryAuth) - Build an Image From a Dockerfile
- Docker Documentation
options+registryAuthusernamepasswordserveraddress
client.images().create(options, registryAuth) - Create Image
- Docker Documentation
optionsfromImagefromSrcrepoqtag
registryAuthusernamepasswordserveraddress
client.images().inspect(name, options) - Inspect an Image
- Docker Documentation
name- the name or id of the imageoptions
client.images().history(name, options) - History of an Image
- Docker Documentation
name- the name or id of the imageoptions
client.images().push(name, options, registryAuth) - Push an Image on the Registry
- Docker Documentation
name- the name or id of the imageoptionstag
registryAuthusernamepasswordserveraddress
client.images().tag(name, options) - Tag an Image
- Docker Documentation
name- the name or id of the imageoptionsrepotag
client.images().remove(name, options) - Remove of Image
- Docker Documentation
name- the name or id of the imageoptionsrepotag
client.images().search(options) - Search Images
- Docker Documentation
name- the name or id of the imageoptionstermlimitfilters
Networks
client.networks().list(options) - List Networks
- Docker Documentation
optionsfilters- JSON encoded network list filter.
client.networks().create(model, options) - Create a Network
- Docker Documentation
model- a json model representing the networkoptions
client.networks().inspect(id, options) - Inspect a Network
- Docker Documentation
id- the network id or nameoptions
client.networks().remove(id, options) - Remove a Network
- Docker Documentation
id- the network id or nameoptions
client.networks().connect(id, options) - Connect a Container to a Network
- Docker Documentation
id- the network id or nameoptions
client.networks().disconnect(id, options) - Disconnect a Container to a Network
- Docker Documentation
id- the network id or nameoptions
Nodes
client.nodes().list(options) - List Nodes
- Docker Documentation
id- the node idoptionsfilters- JSON encoded node list filter.
client.nodes().inspect(id, options) - Inspect a Node
- Docker Documentation
id- the node idoptions
client.nodes().remove(id, options) - Remove a Node
- Docker Documentation
id- the node idoptions
client.nodes().update(id, options) - Update A Node
- Docker Documentation
id- the node idoptionsversion- The version number of the node object being updated. This is required to avoid conflicting writes.
Plugins
client.plugins().list(options) - List Plugins
- Docker Documentation
optionsfilters- a JSON encoded value of the filters (a mapstringstring) to process on the services list.
client.plugins().install(options) - Install a Plugin
- Docker Documentation
optionsname- Name of the plugin to pull. The name may include a tag or digest. This parameter is required.
client.plugins().inspect(id, options) - Inspect a Plugin
- Docker Documentation
options
client.plugins().enable(id, options) - Enable a Plugin
- Docker Documentation
options
client.plugins().disable(id, options) - Disable a Plugin
- Docker Documentation
options
client.plugins().remove(id, options) - Remove a Plugin
- Docker Documentation
options
Services
client.services().list(options) - List Services
- Docker Documentation
optionsfilters- a JSON encoded value of the filters (a mapstringstring) to process on the services list.
client.services().create(options, registryAuth) - Create a Service
- Docker Documentation
options
client.services().remove(id, options) - Remove a Service
- Docker Documentation
id- id or name of the serviceoptions
client.services().inspect(id, options) - Inspect a Service
- Docker Documentation
id- id or name of the serviceoptions
client.services().logs(id, options) - Get Service Logs
- Docker Documentation
id- id or name of the serviceoptionsdetails- 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.
client.services().update(id, options, registryAuth) - Update a Service
- Docker Documentation
id- id or name of the serviceoptionsversion- The version number of the service object being updated. This is required to avoid conflicting writes.
Swarm
client.swarm().info(options) - Swarm Info
- Docker Documentation
options
client.swarm().init(options) - Initialize a Swarm
- Docker Documentation
options
client.swarm().join(options) - Join a Swarm
- Docker Documentation
options
client.swarm().leave(options) - Leave a Swarm
- Docker Documentation
optionsforce- Boolean (false/true). Force leave swarm, even if this is the last manager or that it will break the cluster.
client.swarm().update(options) - Update a Swarm
- Docker Documentation
optionsversion- 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
client.tasks().list(options) - List Services
- Docker Documentation
optionsfilters- a JSON encoded value of the filters (a mapstringstring) to process on the tasks list.
client.tasks().inspect(id, options) - Inspect a Task
- Docker Documentation
options
Volumes
client.volumes().list(options) - List Volumes
- Docker Documentation
optionsfilters- a JSON encoded value of the filters (a mapstringstring) to process on the volumes list.
client.volumes().create(options, registryAuth) - Create a Volume
- Docker Documentation
idor name of the volumeoptions
client.volumes().remove(id, options) - Remove a Volume
- Docker Documentation
idor name of the volumeoptions
client.volumes().inspect(id, options) - Inspect a Volume
- Docker Documentation
idor name of the volumeoptions
Daemon
client.info() - System Wide Information
client.auth(options) - Authentication Configuration
- Docker Documentation
optionsusernamepasswordserveraddress
client.version() - Version
client.ping() - Ping Daemon
client.events() - Events Stream
- Docker Documentation
optionssince- 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 mapstringstring) to process on the event list

