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,6 +429,7 @@ async function docker() {
let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
containerId = result.stdout; containerId = result.stdout;
try {
if (argv['random']) { if (argv['random']) {
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
let netSettings = JSON.parse(inspect.stdout); let netSettings = JSON.parse(inspect.stdout);
@ -438,6 +439,12 @@ async function docker() {
} }
if (runChown) await dockerWait(); if (runChown) await dockerWait();
} catch (err) {
if (argv['random'])
await execP(`docker rm -fv ${containerId}`);
throw err;
}
return containerId; return containerId;
} }
docker.description = `Builds the database image and runs a container`; docker.description = `Builds the database image and runs a container`;