attach to network
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
This commit is contained in:
parent
1cafbdab6e
commit
627f0d762e
|
@ -45,7 +45,6 @@ module.exports = class Docker {
|
||||||
log('Starting container...');
|
log('Starting container...');
|
||||||
const container = await this.execP(`
|
const container = await this.execP(`
|
||||||
docker run \
|
docker run \
|
||||||
--network="jenkins" \
|
|
||||||
--env RUN_CHOWN=${runChown} \
|
--env RUN_CHOWN=${runChown} \
|
||||||
-d ${dockerArgs} salix-db
|
-d ${dockerArgs} salix-db
|
||||||
`);
|
`);
|
||||||
|
@ -53,14 +52,15 @@ module.exports = class Docker {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.isRandom) {
|
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 inspect = await this.execP(`docker inspect -f "{{json .NetworkSettings}}" ${this.id}`);
|
||||||
let netSettings = JSON.parse(inspect.stdout);
|
let netSettings = JSON.parse(inspect.stdout);
|
||||||
|
|
||||||
if (ci) {
|
if (ci) {
|
||||||
this.dbConf.host = netSettings.Networks.jenkins.IPAddress;
|
this.dbConf.host = netSettings.Networks.jenkins.IPAddress;
|
||||||
this.dbConf.port = 3306;
|
this.dbConf.port = 3306;
|
||||||
|
|
||||||
await this.execP(`docker network connect jenkins ${this.id}`);
|
|
||||||
} else
|
} else
|
||||||
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue