Skip to content

Instantly share code, notes, and snippets.

@apatil
Last active December 25, 2015 07:19
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 apatil/6938813 to your computer and use it in GitHub Desktop.
Save apatil/6938813 to your computer and use it in GitHub Desktop.
On Ubuntu 12.04, with Docker version 0.6.3, build b0a49a3, this script will cause iptables failures to prevent launch of some docker containers
#!/usr/bin/env node
var shell = require("shelljs")
var n = 100;
var nPorts = 10;
var port = 40000;
var launchCmds = [];
for (var i = 0; i < n; i++) {
var portString = "";
var innerPort = 3000;
for (var j=0; j<nPorts; j++) {
portString += " -p " + port + ":" + innerPort;
innerPort++;
port++;
}
launchCmds.push("docker -H 127.0.0.1:4243 run -d" + portString + " ubuntu:12.04 sleep 5")
}
var ids = [];
var cb = function(code, output) {
console.log(code, output);
};
for (var i = 0; i < n; i++) {
shell.exec(launchCmds[i], {async: true}, cb)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment