DB container removed on error
gitea/salix/test This commit looks good Details
gitea/salix/master This commit looks good Details

This commit is contained in:
Juan Ferrer 2019-12-23 16:39:26 +01:00
parent 305774554e
commit 69b53b3cdc
1 changed files with 13 additions and 6 deletions

View File

@ -429,15 +429,22 @@ async function docker() {
let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
containerId = result.stdout;
if (argv['random']) {
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
let netSettings = JSON.parse(inspect.stdout);
try {
if (argv['random']) {
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
let netSettings = JSON.parse(inspect.stdout);
dbConf.host = netSettings.Gateway;
dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
dbConf.host = netSettings.Gateway;
dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
}
if (runChown) await dockerWait();
} catch (err) {
if (argv['random'])
await execP(`docker rm -fv ${containerId}`);
throw err;
}
if (runChown) await dockerWait();
return containerId;
}
docker.description = `Builds the database image and runs a container`;