mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-18 04:59:31 +00:00
cleanup volumes as well
This commit is contained in:
@@ -1762,7 +1762,7 @@ export function convertTolOldVolumeNames(type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cleanupDockerStorage(dockerId) {
|
export async function cleanupDockerStorage(dockerId, volumes = false) {
|
||||||
// Cleanup images that are not used by any container
|
// Cleanup images that are not used by any container
|
||||||
try {
|
try {
|
||||||
await executeCommand({ dockerId, command: `docker image prune -af` });
|
await executeCommand({ dockerId, command: `docker image prune -af` });
|
||||||
@@ -1780,6 +1780,11 @@ export async function cleanupDockerStorage(dockerId) {
|
|||||||
try {
|
try {
|
||||||
await executeCommand({ dockerId, command: `docker builder prune -af` });
|
await executeCommand({ dockerId, command: `docker builder prune -af` });
|
||||||
} catch (error) { }
|
} catch (error) { }
|
||||||
|
if (volumes) {
|
||||||
|
try {
|
||||||
|
await executeCommand({ dockerId, command: `docker volume prune -a` });
|
||||||
|
} catch (error) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function persistentVolumes(id, persistentStorage, config) {
|
export function persistentVolumes(id, persistentStorage, config) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export async function cleanupManually(request: FastifyRequest) {
|
|||||||
const destination = await prisma.destinationDocker.findUnique({
|
const destination = await prisma.destinationDocker.findUnique({
|
||||||
where: { id: serverId }
|
where: { id: serverId }
|
||||||
});
|
});
|
||||||
await cleanupDockerStorage(destination.id);
|
await cleanupDockerStorage(destination.id, true);
|
||||||
return {};
|
return {};
|
||||||
} catch ({ status, message }) {
|
} catch ({ status, message }) {
|
||||||
return errorHandler({ status, message });
|
return errorHandler({ status, message });
|
||||||
|
|||||||
Reference in New Issue
Block a user