Created
September 24, 2014 18:59
-
-
Save masonforest/10ac17877c0af6d64d54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Docker = require('dockerode'); | |
var docker = new Docker({ socketPath: false, host: '192.168.59.103', port: '2375' }); | |
var optsc = { | |
'Hostname': '', | |
'User': '', | |
'AttachStdin': true, | |
'AttachStdout': true, | |
'AttachStderr': true, | |
'Tty': false, | |
'OpenStdin': true, | |
'StdinOnce': true, | |
'Env': null, | |
'Cmd': ['wc','-c'], | |
'Dns': ['8.8.8.8', '8.8.4.4'], | |
'Image': 'ubuntu', | |
'Volumes': {}, | |
'VolumesFrom': '' | |
}; | |
function handler(err, container) { | |
var attach_opts = {stream: true, stdin: true, stdout: true, stderr: true}; | |
container.attach(attach_opts, function handler(err, stream) { | |
stream.pipe(process.stdout); | |
container.start(function(err, data) { | |
stream.write('hello'); | |
stream.end(); | |
}); | |
}); | |
} | |
docker.createContainer(optsc, handler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment