diff --git a/db/docker.js b/db/docker.js index 3bf05cc9b..1ab4115e5 100644 --- a/db/docker.js +++ b/db/docker.js @@ -45,7 +45,6 @@ module.exports = class Docker { log('Starting container...'); const container = await this.execP(` docker run \ - --network="jenkins" \ --env RUN_CHOWN=${runChown} \ -d ${dockerArgs} salix-db `); @@ -53,14 +52,15 @@ module.exports = class Docker { try { if (this.isRandom) { + if (ci) + await this.execP(`docker network connect jenkins ${this.id}`); + let inspect = await this.execP(`docker inspect -f "{{json .NetworkSettings}}" ${this.id}`); let netSettings = JSON.parse(inspect.stdout); if (ci) { this.dbConf.host = netSettings.Networks.jenkins.IPAddress; this.dbConf.port = 3306; - - await this.execP(`docker network connect jenkins ${this.id}`); } else this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; }