diff --git a/db/docker.js b/db/docker.js index b52c2639b..3eb262a82 100644 --- a/db/docker.js +++ b/db/docker.js @@ -19,8 +19,9 @@ module.exports = class Docker { * to avoid a bug with OverlayFS driver on MacOS. * * @param {Boolean} ci continuous integration environment argument + * @param {String} networkName Name of the container network */ - async run(ci) { + async run(ci, networkName = 'jenkins') { let d = new Date(); let pad = v => v < 10 ? '0' + v : v; let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; @@ -43,7 +44,7 @@ module.exports = class Docker { let runChown = process.platform != 'linux'; let network = ''; - if (ci) network = '--network="jenkins"'; + if (ci) network = `--network="${networkName}"`; log('Starting container...'); const container = await this.execP(` @@ -60,7 +61,7 @@ module.exports = class Docker { let netSettings = JSON.parse(inspect.stdout); if (ci) { - this.dbConf.host = netSettings.Networks.jenkins.IPAddress; + this.dbConf.host = netSettings.Networks[networkName].IPAddress; this.dbConf.port = 3306; } else this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];