docker-run
Start a docker image and attach to it
npm install docker-run
There is also a command line tool available
Usage
var run = require('docker-run')
var child = run('mafintosh/dev', {tty:true})
process.stdin.setRawMode(true)
process.stdin.pipe(child.stdin)
child.stdout.pipe(process.stdout)
child.stderr.pipe(process.stderr)
API
child = run(image, [options])
Where options can be
{
net: 'bridge',
tty: true,
fork: true,
remove: true,
dns: ['8.8.8.8'],
ports: {
8080: 8081
},
volumes: {
'/root': '/tmp',
'/root': '/tmp2:ro'
},
links: {
'container-name': 'alias'
},
env: {
FOO: 'bar'
},
entrypoint: '/bin/bash'
beforeCreate: function (remoteOpts, instance) {}
}
child.stdin, child.stderr, child.stdout
The stdio streams for the container. Is null if fork: true
Destroy the child container
Resize the container pty (if tty: true)
Events
child.on('exit', exitCode)
Emitted when the container exits
child.on('spawn', containerId)
Emitted when the container is spawned
Emitted if the container experiences a fatal error
Command line usage
To install the command line tool do
npm install -g docker-run
And then run
docker-run --help
To view the help. In general to run an image do
docker-run [image]
License
MIT