Comparing version 2.2.5 to 2.2.6
@@ -397,2 +397,3 @@ var extend = require('./util').extend, | ||
isStream: true, | ||
hijack: args.opts.hijack, | ||
openStdin: args.opts.stdin, | ||
@@ -399,0 +400,0 @@ statusCodes: { |
@@ -26,2 +26,3 @@ var util = require('./util'); | ||
isStream: true, | ||
hijack: args.opts.hijack, | ||
openStdin: args.opts.stdin, | ||
@@ -28,0 +29,0 @@ statusCodes: { |
{ | ||
"name": "dockerode", | ||
"description": "Docker Remote API module.", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"author": "Pedro Dias <petermdias@gmail.com>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -152,2 +152,22 @@ # dockerode | ||
There is also support for [HTTP connection hijacking](https://docs.docker.com/engine/reference/api/docker_remote_api_v1.22/#3-2-hijacking), | ||
which allows for cleaner interactions with commands that work with stdin and stdout separately. | ||
```js | ||
docker.createContainer({Tty: false, /*... other options */}, function(err, container) { | ||
container.exec({Cmd: ['shasum', '-'], AttachStdin: true, AttachStdout: true}, function(err, exec) { | ||
exec.start({hijack: true, stdin: true}, function(err, stream) { | ||
// shasum can't finish until after its stdin has been closed, telling it that it has | ||
// read all the bytes it needs to sum. Without a socket upgrade, there is no way to | ||
// close the write-side of the stream without also closing the read-side! | ||
fs.createReadStream('node-v5.1.0.tgz', 'binary').pipe(stream); | ||
// Fortunately, we have a regular TCP socket now, so when the readstream finishes and closes our | ||
// stream, it is still open for reading and we will still get our results :-) | ||
docker.modem.demuxStream(stream, process.stdout, process.stderr); | ||
}); | ||
}); | ||
}); | ||
``` | ||
### Equivalent of `docker run` in `dockerode`: | ||
@@ -154,0 +174,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54347
1478
296