attach to network
gitea/salix/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Joan Sanchez 2022-10-05 12:33:06 +02:00
parent 1cafbdab6e
commit 627f0d762e
1 changed files with 3 additions and 3 deletions

View File

@ -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'];
}