ducke-modem
v1.0.0
Published
A low level nodejs API for talking with docker
Downloads
8
Readme
Ducke Modem
A low level nodejs API for talking with docker.
Request types:
- GET
- POST
- DELETE
Request payloads:
- Data
- Stream
- File
Response payloads:
- Data
- Stream
- Duplex Stream
If you are looking for a high level nodejs docker API use ducke or dockerode.
Insipred by docker-modem.
Install
npm install ducke-modem
Ducke Modem depends on readable-stream
.
Examples
var duckemodem = require('ducke-modem');
var modem = new duckemodem.API(duckemodem.Parameters());
// get all available containers
modem
.get('/containers/json?all=1')
.result(function(err, containers) {
console.log(containers);
});
// stream logs
modem
.get("/containers/my_container/logs?stderr=1&stdout=1&follow=1&tail=10")
.stream(function(err, stream) {
duckemodem.DemuxStream(stream, process.stdout, process.stderr);
});
// attach to a container
modem
.post("/containers/my_container/attach?stream=true&stdin=true&stdout=true&stderr=true", {})
.connect(function(err, stream) {
stream.pipe(process.stdout);
process.stdin.resume()
process.stdin.setEncoding('utf8');
process.stdin.setRawMode(true);
process.stdin.pipe(stream);
});
Todo
- Fix DemuxStream
- Test against all docker API methods
- Write Tests