mirror of
https://github.com/valentineus/simple-container.git
synced 2025-04-28 00:41:24 +03:00
Add an API description
This commit is contained in:
parent
086b9032d5
commit
0afd2000a5
27
README.md
27
README.md
@ -19,10 +19,9 @@ npm install --save simple-container
|
|||||||
A simple example that creates and starts a container:
|
A simple example that creates and starts a container:
|
||||||
```JavaScript
|
```JavaScript
|
||||||
import Containers from 'simple-container';
|
import Containers from 'simple-container';
|
||||||
|
|
||||||
var containers = new Containers();
|
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.`);
|
console.info(`The ${container.id} container was created.`);
|
||||||
start(container);
|
start(container);
|
||||||
});
|
});
|
||||||
@ -74,6 +73,8 @@ containers.create({
|
|||||||
Examples and details in
|
Examples and details in
|
||||||
[the documentation](https://github.com/apocas/dockerode#manipulating-a-container).
|
[the documentation](https://github.com/apocas/dockerode#manipulating-a-container).
|
||||||
|
|
||||||
|
#### Third-party repository
|
||||||
|
|
||||||
An additional example of obtaining a private image:
|
An additional example of obtaining a private image:
|
||||||
```JavaScript
|
```JavaScript
|
||||||
var auth = {
|
var auth = {
|
||||||
@ -92,6 +93,28 @@ containers.create({
|
|||||||
Details in
|
Details in
|
||||||
[the documentation](https://github.com/apocas/dockerode#pull-from-private-repos).
|
[the documentation](https://github.com/apocas/dockerode#pull-from-private-repos).
|
||||||
|
|
||||||
|
## API
|
||||||
|
### create(options) ⇒ <code>Promise</code>
|
||||||
|
Creates a container by options or name, returning the management interface.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| options | <code>String</code> \ <code>Object</code> | The name of the image or options |
|
||||||
|
|
||||||
|
### get([id]) ⇒ <code>Promise</code>
|
||||||
|
Returns the container management interface.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| [id] | <code>String</code> | Container ID |
|
||||||
|
|
||||||
|
### info([id]) ⇒ <code>Promise</code>
|
||||||
|
Searches in existing containers.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| [id] | <code>String</code> | Container ID |
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
Use the `DEBUG` variable with the `containers` option.
|
Use the `DEBUG` variable with the `containers` option.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user