@augment-vir/node
Version:
A collection of augments, helpers types, functions, and classes only for Node.js (backend) JavaScript environments.
13 lines (12 loc) • 541 B
JavaScript
import { runShellCommand } from '../../augments/terminal/shell.js';
import { waitUntilContainerExited, waitUntilContainerRemoved } from './container-status.js';
export async function killContainer(containerNameOrId, options = {}) {
await runShellCommand(`docker kill '${containerNameOrId}'`);
if (options.keepContainer) {
await waitUntilContainerExited(containerNameOrId);
}
else {
await runShellCommand(`docker rm '${containerNameOrId}'`);
await waitUntilContainerRemoved(containerNameOrId);
}
}