mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-13 01:45:23 +02:00
feat(docker): implement container removal functionality
- Added RemoveContainerDialog component for user confirmation before removing a Docker container. - Integrated the dialog into the container management UI. - Implemented server-side logic for container removal, including permission checks and error handling. - Updated API router to include the new removeContainer mutation.
This commit is contained in:
@@ -371,6 +371,21 @@ export const containerRestart = async (containerId: string) => {
|
||||
} catch {}
|
||||
};
|
||||
|
||||
export const containerRemove = async (
|
||||
containerId: string,
|
||||
serverId?: string,
|
||||
) => {
|
||||
const command = `docker rm -f ${containerId}`;
|
||||
const { stderr } = serverId
|
||||
? await execAsyncRemote(serverId, command)
|
||||
: await execAsync(command);
|
||||
|
||||
if (stderr) {
|
||||
console.error(`Error: ${stderr}`);
|
||||
throw new Error(stderr);
|
||||
}
|
||||
};
|
||||
|
||||
export const getSwarmNodes = async (serverId?: string) => {
|
||||
try {
|
||||
let stdout = "";
|
||||
|
||||
Reference in New Issue
Block a user