UNPKG

24.4 kBMarkdownView Raw
1# dockerode
2
3Not another Node.js Docker Remote API module.
4
5`dockerode` objectives:
6
7* **streams** - `dockerode` does NOT break any stream, it passes them to you allowing for some stream voodoo.
8* **stream demux** - Supports optional [stream demultiplexing](https://github.com/apocas/dockerode#helper-functions).
9* **entities** - containers, images and execs are defined entities and not random static methods.
10* **run** - `dockerode` allow you to seamless run commands in a container ala `docker run`.
11* **tests** - `dockerode` really aims to have a good test set, allowing to follow `Docker` changes easily, quickly and painlessly.
12* **feature-rich** - There's a real effort in keeping **All** `Docker` Remote API features implemented and tested.
13* **interfaces** - Features **callback** and **promise** based interfaces, making everyone happy :)
14
15## Ecosystem
16
17 * docker-modem [https://github.com/apocas/docker-modem](https://github.com/apocas/docker-modem) - Docker's API network stack
18 * dockerode-compose [https://github.com/apocas/dockerode-compose](https://github.com/apocas/dockerode-compose) - docker-compose in Node.js
19
20## Installation
21
22`npm install dockerode`
23
24## Usage
25
26 * Input options are directly passed to Docker. Check [Docker API documentation](https://docs.docker.com/engine/api/latest/) for more details.
27 * Return values are unchanged from Docker, official Docker documentation will also apply to them.
28 * Check the tests and examples folder for more examples.
29
30### Getting started
31
32To use `dockerode` first you need to instantiate it:
33
34``` js
35var Docker = require('dockerode');
36var docker = new Docker({socketPath: '/var/run/docker.sock'});
37var docker1 = new Docker(); //defaults to above if env variables are not used
38var docker2 = new Docker({host: 'http://192.168.1.10', port: 3000});
39var docker3 = new Docker({protocol:'http', host: '127.0.0.1', port: 3000});
40var docker4 = new Docker({host: '127.0.0.1', port: 3000}); //defaults to http
41
42//protocol http vs https is automatically detected
43var docker5 = new Docker({
44 host: '192.168.1.10',
45 port: process.env.DOCKER_PORT || 2375,
46 ca: fs.readFileSync('ca.pem'),
47 cert: fs.readFileSync('cert.pem'),
48 key: fs.readFileSync('key.pem'),
49 version: 'v1.25' // required when Docker >= v1.13, https://docs.docker.com/engine/api/version-history/
50});
51
52var docker6 = new Docker({
53 protocol: 'https', //you can enforce a protocol
54 host: '192.168.1.10',
55 port: process.env.DOCKER_PORT || 2375,
56 ca: fs.readFileSync('ca.pem'),
57 cert: fs.readFileSync('cert.pem'),
58 key: fs.readFileSync('key.pem')
59});
60
61//using a different promise library (default is the native one)
62var docker7 = new Docker({
63 Promise: require('bluebird')
64 //...
65});
66//...
67```
68
69### Manipulating a container:
70
71``` js
72// create a container entity. does not query API
73var container = docker.getContainer('71501a8ab0f8');
74
75// query API for container info
76container.inspect(function (err, data) {
77 console.log(data);
78});
79
80container.start(function (err, data) {
81 console.log(data);
82});
83
84container.remove(function (err, data) {
85 console.log(data);
86});
87
88// promises are supported
89var auxContainer;
90docker.createContainer({
91 Image: 'ubuntu',
92 AttachStdin: false,
93 AttachStdout: true,
94 AttachStderr: true,
95 Tty: true,
96 Cmd: ['/bin/bash', '-c', 'tail -f /var/log/dmesg'],
97 OpenStdin: false,
98 StdinOnce: false
99}).then(function(container) {
100 auxContainer = container;
101 return auxContainer.start();
102}).then(function(data) {
103 return auxContainer.resize({
104 h: process.stdout.rows,
105 w: process.stdout.columns
106 });
107}).then(function(data) {
108 return auxContainer.stop();
109}).then(function(data) {
110 return auxContainer.remove();
111}).then(function(data) {
112 console.log('container removed');
113}).catch(function(err) {
114 console.log(err);
115});
116```
117
118You may also specify default options for each container's operations, which will always be used for the specified container and operation.
119
120``` js
121container.defaultOptions.start.Binds = ["/tmp:/tmp:rw"];
122```
123
124### Stopping all containers on a host
125
126``` js
127docker.listContainers(function (err, containers) {
128 containers.forEach(function (containerInfo) {
129 docker.getContainer(containerInfo.Id).stop(cb);
130 });
131});
132```
133
134### Building an Image
135Context: provides the path to the Dockerfile. Additionaly files that are involved in the build *must* be explicitly mentioned in src array, since they are sent to a temp env to build. Example: file for COPY command are extracted from that temporary environment.
136
137``` js
138docker.buildImage('archive.tar', {t: imageName}, function (err, response){
139 //...
140});
141
142docker.buildImage({
143 context: __dirname,
144 src: ['Dockerfile', 'file1', 'file2']
145}, {t: imageName}, function (err, response) {
146 //...
147});
148```
149
150`buildImage` returns a Promise of NodeJS stream. In case you want to find out when the build has finished, you must follow the progress of the build with the `modem` instance in dockerode:
151
152``` js
153let dockerode = new Dockerode();
154let stream = await dockerode.buildImage(...);
155await new Promise((resolve, reject) => {
156 dockerode.modem.followProgress(stream, (err, res) => err ? reject(err) : resolve(res));
157});
158// Build has finished
159```
160
161
162### Creating a container:
163
164``` js
165docker.createContainer({Image: 'ubuntu', Cmd: ['/bin/bash'], name: 'ubuntu-test'}, function (err, container) {
166 container.start(function (err, data) {
167 //...
168 });
169});
170//...
171```
172
173### Streams goodness:
174
175``` js
176//tty:true
177docker.createContainer({ /*...*/ Tty: true /*...*/ }, function(err, container) {
178
179 /* ... */
180
181 container.attach({stream: true, stdout: true, stderr: true}, function (err, stream) {
182 stream.pipe(process.stdout);
183 });
184
185 /* ... */
186});
187
188//tty:false
189docker.createContainer({ /*...*/ Tty: false /*...*/ }, function(err, container) {
190
191 /* ... */
192
193 container.attach({stream: true, stdout: true, stderr: true}, function (err, stream) {
194 //dockerode may demultiplex attach streams for you :)
195 container.modem.demuxStream(stream, process.stdout, process.stderr);
196 });
197
198 /* ... */
199});
200
201docker.createImage({fromImage: 'ubuntu'}, function (err, stream) {
202 stream.pipe(process.stdout);
203});
204
205//...
206```
207
208There is also support for [HTTP connection hijacking](https://docs.docker.com/engine/api/v1.22/#32-hijacking),
209which allows for cleaner interactions with commands that work with stdin and stdout separately.
210
211```js
212docker.createContainer({Tty: false, /*... other options */}, function(err, container) {
213 container.start(function(err) {
214 container.exec({Cmd: ['shasum', '-'], AttachStdin: true, AttachStdout: true}, function(err, exec) {
215 exec.start({hijack: true, stdin: true}, function(err, stream) {
216 // shasum can't finish until after its stdin has been closed, telling it that it has
217 // read all the bytes it needs to sum. Without a socket upgrade, there is no way to
218 // close the write-side of the stream without also closing the read-side!
219 fs.createReadStream('node-v5.1.0.tgz', 'binary').pipe(stream);
220
221 // Fortunately, we have a regular TCP socket now, so when the readstream finishes and closes our
222 // stream, it is still open for reading and we will still get our results :-)
223 docker.modem.demuxStream(stream, process.stdout, process.stderr);
224 });
225 });
226 });
227});
228```
229
230### Equivalent of `docker run` in `dockerode`:
231
232* `image` - container image
233* `cmd` - command to be executed
234* `stream` - stream(s) which will be used for execution output.
235* `create_options` - (optional) Options used for container creation. Refer to the [DockerEngine ContainerCreate documentation](https://docs.docker.com/engine/api/v1.37/#operation/ContainerCreate) for the possible values
236* `start_options` - (optional) Options used for container start. Refer to the [DockerEngine ContainerStart documentation](https://docs.docker.com/engine/api/v1.37/#operation/ContainerStart) for the possible values
237* `callback` - callback called when execution ends (optional, promise will be returned if not used).
238
239``` js
240//callback
241docker.run('ubuntu', ['bash', '-c', 'uname -a'], process.stdout, function (err, data, container) {
242 console.log(data.StatusCode);
243});
244
245//promise
246docker.run(testImage, ['bash', '-c', 'uname -a'], process.stdout).then(function(data) {
247 var output = data[0];
248 var container = data[1];
249 console.log(output.StatusCode);
250 return container.remove();
251}).then(function(data) {
252 console.log('container removed');
253}).catch(function(err) {
254 console.log(err);
255});
256```
257
258or, if you want to split stdout and stderr (you must to pass `Tty:false` as an option for this to work)
259
260``` js
261docker.run('ubuntu', ['bash', '-c', 'uname -a'], [process.stdout, process.stderr], {Tty:false}, function (err, data, container) {
262 console.log(data.StatusCode);
263});
264```
265
266If you provide a callback, `run` will return an EventEmitter supporting the following events: container, stream, data.
267If a callback isn't provided a promise will be returned.
268
269``` js
270docker.run('ubuntu', ['bash', '-c', 'uname -a'], [process.stdout, process.stderr], {Tty:false}, function (err, data, container) {
271 //...
272}).on('container', function (container) {
273 //...
274});
275```
276
277And here is one more complex example using auto-remove and Docker network.
278
279``` js
280docker.run('some-python-image', ['python', 'main.py', arg], process.stdout, {name: 'my-python-container', HostConfig: { AutoRemove: true, NetworkMode: 'my_network'}}, function(err, data, container) {
281 // Do stuff
282});
283```
284
285### Equivalent of `docker pull` in `dockerode`:
286
287* `repoTag` - container image name (optionally with tag)
288 `myrepo/myname:withtag`
289* `options` - extra options passed to create image.
290* `callback` - callback called when execution ends.
291
292``` js
293docker.pull('myrepo/myname:tag', function (err, stream) {
294 // streaming output from pull...
295});
296```
297
298#### Pull from private repos
299
300`docker-modem` already base64 encodes the necessary auth object for you.
301
302``` js
303var auth = {
304 username: 'username',
305 password: 'password',
306 auth: '',
307 email: 'your@email.email',
308 serveraddress: 'https://index.docker.io/v1'
309};
310
311docker.pull('tag', {'authconfig': auth}, function (err, stream) {
312 //...
313});
314```
315
316If you already have a base64 encoded auth object, you can use it directly:
317
318```js
319var auth = { key: 'yJ1J2ZXJhZGRyZXNzIjoitZSI6Im4OCIsImF1dGgiOiIiLCJlbWFpbCI6ImZvbGllLmFkcmc2VybmF0iLCJzZX5jb2aHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdZvbGllYSIsInBhc3N3b3JkIjoiRGVjZW1icmUjEvIn0=' }
320```
321
322
323## Helper functions
324
325* `followProgress` - allows to fire a callback only in the end of a stream based process. (build, pull, ...)
326
327``` js
328//followProgress(stream, onFinished, [onProgress])
329docker.pull(repoTag, function(err, stream) {
330 //...
331 docker.modem.followProgress(stream, onFinished, onProgress);
332
333 function onFinished(err, output) {
334 //output is an array with output json parsed objects
335 //...
336 }
337 function onProgress(event) {
338 //...
339 }
340});
341```
342
343* `demuxStream` - demux stdout and stderr
344
345``` js
346//demuxStream(stream, stdout, stderr)
347container.attach({
348 stream: true,
349 stdout: true,
350 stderr: true
351}, function handler(err, stream) {
352 //...
353 container.modem.demuxStream(stream, process.stdout, process.stderr);
354 //...
355});
356```
357
358## Sponsors
359
360Amazing entities that [sponsor](https://github.com/sponsors/apocas) my open-source work. Check them out!
361
362[![HTTP Toolkit](https://avatars.githubusercontent.com/u/39777515?s=100)](https://github.com/httptoolkit)
363
364## Documentation
365
366### Docker
367
368- docker.createContainer(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerCreate)
369- docker.createImage([auth], options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageCreate)
370- docker.loadImage(file, options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageLoad)
371- docker.importImage(file, options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageCreate)
372- docker.buildImage(file, options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageBuild)
373- docker.checkAuth(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SystemAuth)
374- docker.getContainer(id) - Returns a Container object.
375- docker.getImage(name) - Returns an Image object.
376- docker.getVolume(name) - Returns a Volume object.
377- docker.getPlugin(name) - Returns a Plugin object.
378- docker.getService(id) - Returns a Service object.
379- docker.getTask(id) - Returns a Task object.
380- docker.getNode(id) - Returns a Node object.
381- docker.getNetwork(id) - Returns a Network object.
382- docker.getSecret(id) - Returns a Secret object.
383- docker.getConfig(id) - Returns a Config object.
384- docker.getExec(id) - Returns a Exec object.
385- docker.listContainers(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerList)
386- docker.listImages(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageList)
387- docker.listServices(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ServiceList)
388- docker.listNodes(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NodeList)
389- docker.listTasks(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/TaskList)
390- docker.listSecrets(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SecretList)
391- docker.listConfigs(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ConfigList)
392- docker.listPlugins(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginList)
393- docker.listVolumes(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/VolumeList)
394- docker.listNetworks(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkList)
395- docker.createSecret(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SecretCreate)
396- docker.createConfig(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ConfigCreate)
397- docker.createPlugin(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginCreate)
398- docker.createVolume(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/VolumeCreate)
399- docker.createService(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ServiceCreate)
400- docker.createNetwork(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkCreate)
401- docker.pruneImages(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImagePrune)
402- docker.pruneBuilder() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/BuildPrune)
403- docker.pruneContainers(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerPrune)
404- docker.pruneVolumes(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/VolumePrune)
405- docker.pruneNetworks(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkPrune)
406- docker.searchImages(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageSearch)
407- docker.info() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SystemInfo)
408- docker.version() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SystemVersion)
409- docker.ping() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SystemPing)
410- docker.df() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SystemDataUsage)
411- docker.getEvents(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SystemEvents)
412- docker.swarmInit(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmInit)
413- docker.swarmJoin(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmJoin)
414- docker.swarmLeave(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmLeave)
415- docker.swarmUpdate(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmUpdate)
416- docker.swarmInspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SwarmInspect)
417- docker.pull(repoTag, options, callback, auth) - Like Docker's CLI pull
418- docker.run(image, cmd, stream, createOptions, startOptions) - Like Docker's CLI run
419
420
421### Container
422
423- container.inspect(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerInspect)
424- container.rename(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerRename)
425- container.update(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerUpdate)
426- container.top(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerTop)
427- container.changes() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerChanges)
428- container.export() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerExport)
429- container.start(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerStart)
430- container.stop(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerStop)
431- container.pause(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerPause)
432- container.unpause(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerUnpause)
433- container.exec(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerExec)
434- container.commit(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageCommit)
435- container.restart(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerRestart)
436- container.kill(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerKill)
437- container.resize(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerResize)
438- container.attach(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerAttach)
439- container.wait(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerWait)
440- container.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerDelete)
441- container.getArchive(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerArchive)
442- container.infoArchive(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerArchiveInfo)
443- container.putArchive(file, options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PutContainerArchive)
444- container.logs(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerLogs)
445- container.stats(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ContainerStats)
446
447### Exec
448
449- exec.start(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ExecStart)
450- exec.resize(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ExecResize)
451- exec.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ExecInspect)
452
453### Image
454
455- image.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageInspect)
456- image.history() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageHistory)
457- image.push(options, callback, auth) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImagePush)
458- image.tag(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageTag)
459- image.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageDelete)
460- image.get() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ImageGet)
461
462### Network
463
464- network.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkInspect)
465- network.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkDelete)
466- network.connect(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkConnect)
467- network.disconnect(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NetworkDisconnect)
468
469### Node
470
471- node.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NodeInspect)
472- node.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NodeDelete)
473- node.update(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/NodeUpdate)
474
475### Plugin
476
477- plugin.privileges() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/GetPluginPrivileges)
478- plugin.pull(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginPull)
479- plugin.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginInspect)
480- plugin.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginDelete)
481- plugin.enable(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginEnable)
482- plugin.disable(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginDisable)
483- plugin.update([auth], options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginUpgrade)
484- plugin.push(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginPush)
485- plugin.configure(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/PluginSet)
486
487### Secret
488
489- secret.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SecretInspect)
490- secret.remove() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SecretDelete)
491- secret.update(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/SecretUpdate)
492
493### Service
494
495- service.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ServiceInspect)
496- service.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ServiceDelete)
497- service.update(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ServiceUpdate)
498- service.logs(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/ServiceLogs)
499
500### Task
501
502- task.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/TaskInspect)
503- task.logs(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/Session)
504
505### Volume
506
507- volume.inspect() - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/VolumeInspect)
508- volume.remove(options) - [Docker API Endpoint](https://docs.docker.com/engine/api/v1.37/#operation/VolumeDelete)
509
510
511## Tests
512
513 * `docker pull ubuntu:latest` to prepare your system for the tests.
514 * Tests are implemented using `mocha` and `chai`. Run them with `npm test`.
515
516## Examples
517
518Check the examples folder for more specific use cases examples.
519
520## License
521
522Pedro Dias - [@pedromdias](https://twitter.com/pedromdias)
523
524Licensed 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:
525
526 http://www.apache.org/licenses/LICENSE-2.0.html
527
528Unless 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.