Skip to content

Instantly share code, notes, and snippets.

@evilpacket
Created May 9, 2014 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilpacket/37df3bf6cd77d9553e6c to your computer and use it in GitHub Desktop.
Save evilpacket/37df3bf6cd77d9553e6c to your computer and use it in GitHub Desktop.
var Docker = require('dockerode');
var docker = new Docker({socketPath: '/var/run/docker.sock'});
docker.createContainer({ Image: 'ubuntu', Cmd: ['/bin/ls','/stuff'], "Volumes":{"/stuff": {}} }, function (err, container) {
container.attach({stream: true, stdout: true, stderr: true, tty: true}, function (err, stream) {
stream.pipe(process.stdout);
container.start({"Binds":["/home/vagrant:/stuff"]}, function (err, data) {
console.log(data);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment