mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Support creating docker networks from the plugin
This commit is contained in:
parent
3ff83f3d3d
commit
888a509c37
@ -78,6 +78,31 @@ export function dockerExec(args: {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a docker network; does not fail if network already exists
|
||||||
|
*/
|
||||||
|
export function dockerCreateNetwork(args: {
|
||||||
|
networkName: string;
|
||||||
|
}): Promise<void> {
|
||||||
|
return new Promise<void>((resolve, reject) => {
|
||||||
|
childProcess.execFile("docker", [
|
||||||
|
"network",
|
||||||
|
"create",
|
||||||
|
args.networkName
|
||||||
|
], { encoding: 'utf8' }, (err, stdout, stderr) => {
|
||||||
|
if(err) {
|
||||||
|
if (stderr.includes(`network with name ${args.networkName} already exists`)) {
|
||||||
|
// Don't consider this as error
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
reject(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function dockerLogs(args: {
|
export async function dockerLogs(args: {
|
||||||
containerId: string;
|
containerId: string;
|
||||||
stdoutFile?: string;
|
stdoutFile?: string;
|
||||||
@ -142,5 +167,6 @@ export function docker(on: PluginEvents, config: PluginConfigOptions) {
|
|||||||
dockerLogs,
|
dockerLogs,
|
||||||
dockerStop,
|
dockerStop,
|
||||||
dockerRm,
|
dockerRm,
|
||||||
|
dockerCreateNetwork
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user