-
-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var Docker = require('../lib/docker'); | ||
var fs = require('fs'); | ||
|
||
var socket = process.env.DOCKER_SOCKET || '/var/run/docker.sock'; | ||
var stats = fs.statSync(socket); | ||
|
||
if (!stats.isSocket()) { | ||
throw new Error("Are you sure the docker is running?"); | ||
} | ||
|
||
//you may specify a timeout for all operations, allowing to make sure you don't fall into limbo if something happens in docker | ||
var docker = new Docker({host: 'http://127.0.0.1', port: 2375, timeout: 1}); | ||
|
||
docker.createContainer({Image: 'ubuntu', Cmd: ['/bin/bash']}, function (err, container) { | ||
container.start(function (err, data) { | ||
container.top({ps_args: 'aux'}, function(err, data) { | ||
console.log(data); | ||
}); | ||
}); | ||
}); |
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
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
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