Merge pull request #56 from crazy-max/docker-context
Some checks failed
publish / publish (push) Has been cancelled

docker: context method
This commit is contained in:
CrazyMax
2023-02-25 12:24:04 +01:00
committed by GitHub
2 changed files with 25 additions and 0 deletions

View File

@@ -38,6 +38,18 @@ export class Docker {
});
}
public static async context(): Promise<string> {
return await Exec.getExecOutput(`docker`, ['context', 'show'], {
ignoreReturnCode: true,
silent: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr);
}
return res.stdout.trim();
});
}
public static async printVersion(): Promise<void> {
await Exec.exec('docker', ['version']);
}