DB container removed on error
This commit is contained in:
parent
305774554e
commit
69b53b3cdc
|
@ -429,6 +429,7 @@ async function docker() {
|
|||
let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||
containerId = result.stdout;
|
||||
|
||||
try {
|
||||
if (argv['random']) {
|
||||
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
|
||||
let netSettings = JSON.parse(inspect.stdout);
|
||||
|
@ -438,6 +439,12 @@ async function docker() {
|
|||
}
|
||||
|
||||
if (runChown) await dockerWait();
|
||||
} catch (err) {
|
||||
if (argv['random'])
|
||||
await execP(`docker rm -fv ${containerId}`);
|
||||
throw err;
|
||||
}
|
||||
|
||||
return containerId;
|
||||
}
|
||||
docker.description = `Builds the database image and runs a container`;
|
||||
|
|
Loading…
Reference in New Issue