From 627f0d762e4653b648bb0fbbb33ee1828c368281 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 5 Oct 2022 12:33:06 +0200 Subject: [PATCH] attach to network --- db/docker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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']; }