From e601a19e4b8f5f2f0ad480c3a12d78185b61d456 Mon Sep 17 00:00:00 2001 From: Ignatiev Mikhail Date: Sat, 16 Jun 2018 19:08:29 +0300 Subject: [PATCH] readme --- readme.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 93c5068..fdc21c7 100644 --- a/readme.md +++ b/readme.md @@ -12,13 +12,21 @@ npm install --save-dev docker-compose `docker-compose` current supports these commands: -* up - create and start containers - always uses the `-d` flag due to non interactive mode -* down - Stop and remove containers, networks, images, and volumes -* kill - Kill containers -* stop - Stop services -* rm - Remove stopped containers - always uses the `-f` flag due to non interactive mode +* `up(options)` - create and start containers - always uses the `-d` flag due to non interactive mode +* `down(options)` - Stop and remove containers, networks, images, and volumes +* `kill(options)` - Kill containers +* `stop(options)` - Stop services +* `rm(options)` - Remove stopped containers - always uses the `-f` flag due to non interactive mode +* `exec(container, command, options)` - Exec `command` inside `container`, uses `-T` to properly handle stdin & stdout +* `run(container, command, options)` - Run `command` inside `container`, uses `-T` to properly handle stdin & stdout -All commands return a Promise. +All commands return a `Promise({object})` with an stdout and stderr strings +```javascript +{ + out: 'stdout contents' + err: 'stderr contents' +} +``` ### Example @@ -32,6 +40,11 @@ compose.up({ cwd: path.join(__dirname), log: true }) ); ``` +To execute command inside a running container +```javascript +compose.exec('node', 'npm install', { cwd: path.join(__dirname) }) +``` + ### Options `docker-compose` accepts these params: