From 0afd2000a5279c71ba3a1a72ad43ba1499507afb Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 7 Oct 2017 01:22:41 +0400 Subject: Add an API description --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1745d2c..5fc2c20 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,9 @@ npm install --save simple-container A simple example that creates and starts a container: ```JavaScript import Containers from 'simple-container'; - var containers = new Containers(); -containers.create('postgres:alpine').then(container => { +containers.create('hello-world:latest').then(container => { console.info(`The ${container.id} container was created.`); start(container); }); @@ -74,6 +73,8 @@ containers.create({ Examples and details in [the documentation](https://github.com/apocas/dockerode#manipulating-a-container). +#### Third-party repository + An additional example of obtaining a private image: ```JavaScript var auth = { @@ -92,6 +93,28 @@ containers.create({ Details in [the documentation](https://github.com/apocas/dockerode#pull-from-private-repos). +## API +### create(options) ⇒ Promise +Creates a container by options or name, returning the management interface. + +| Param | Type | Description | +| --- | --- | --- | +| options | String \ Object | The name of the image or options | + +### get([id]) ⇒ Promise +Returns the container management interface. + +| Param | Type | Description | +| --- | --- | --- | +| [id] | String | Container ID | + +### info([id]) ⇒ Promise +Searches in existing containers. + +| Param | Type | Description | +| --- | --- | --- | +| [id] | String | Container ID | + ## Debugging Use the `DEBUG` variable with the `containers` option. -- cgit v1.2.3