Skip to content

Commit 2064c1d

Browse files
authored
Merge pull request #31 from frankforpresident/master
stdin and env documentation
2 parents 5e239e5 + 302d49b commit 2064c1d

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ var Docker = dockerCLI.Docker;
2828

2929
## Usage
3030

31+
### DockerCLI Options
32+
33+
| Option | Type | Description |
34+
| ------------------------- | ------------------- | ----------------------------------------------------------------- |
35+
| `machineName` | `string` | The name of the Docker machine. |
36+
| `currentWorkingDirectory` | `string` | The current working directory where Docker commands are executed. |
37+
| `echo` | `boolean` | If true, the Docker commands are echoed to the console. |
38+
| `env` | `NodeJS.ProcessEnv` | The environment variables for the Docker process. |
39+
| `stdin` | `string` | The standard input for the Docker process. |
40+
3141
### Modern JS - direct call
3242

3343
```js
@@ -39,6 +49,8 @@ const options = {
3949
machineName: null, // uses local docker
4050
currentWorkingDirectory: null, // uses current working directory
4151
echo: true, // echo command output to stdout/stderr
52+
env: null, // environment variables
53+
stdin: null, // stdin used for the command (useful for passing passwords, etc)
4254
};
4355

4456
const data = await dockerCommand('build -t nginximg .', options);
@@ -599,16 +611,18 @@ docker.command('search nginxcont').then(function (data) {
599611

600612
* docker login
601613

614+
Please use **--password-stdin** for **secure** login
615+
602616
```js
603-
docker.command('login -u myusername -p mypassword').then(function (data) {
617+
docker.command('login -u myusername --password-stdin').then(function (data) {
604618
console.log('data = ', data);
605619
// Successful login
606620
}, function (rejected) {
607621
console.log('rejected = ', rejected);
608622
// Failed login
609623
});
610624

611-
// data = { command: 'docker login -u myusername -p mypassword ',
625+
// data = { command: 'docker login -u myusername --password-stdin ',
612626
// raw: 'Login Succeeded\n',
613627
// login: 'Login Succeeded' }
614628

0 commit comments

Comments
 (0)