mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-16 20:49:28 +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
|
||||
try {
|
||||
await executeCommand({ dockerId, command: `docker image prune -af` });
|
||||
@@ -1780,6 +1780,11 @@ export async function cleanupDockerStorage(dockerId) {
|
||||
try {
|
||||
await executeCommand({ dockerId, command: `docker builder prune -af` });
|
||||
} catch (error) { }
|
||||
if (volumes) {
|
||||
try {
|
||||
await executeCommand({ dockerId, command: `docker volume prune -a` });
|
||||
} catch (error) { }
|
||||
}
|
||||
}
|
||||
|
||||
export function persistentVolumes(id, persistentStorage, config) {
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function cleanupManually(request: FastifyRequest) {
|
||||
const destination = await prisma.destinationDocker.findUnique({
|
||||
where: { id: serverId }
|
||||
});
|
||||
await cleanupDockerStorage(destination.id);
|
||||
await cleanupDockerStorage(destination.id, true);
|
||||
return {};
|
||||
} catch ({ status, message }) {
|
||||
return errorHandler({ status, message });
|
||||
|
||||
Reference in New Issue
Block a user