DB container removed on error
This commit is contained in:
parent
305774554e
commit
69b53b3cdc
19
gulpfile.js
19
gulpfile.js
|
@ -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`;
|
||||
|
|
Loading…
Reference in New Issue