From 19a7a80d43cd99c9f1a96da6fe37122bb599094f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=84=D1=8B=D1=80=D0=B0=D1=82=20=D1=91=D0=B7=D0=B4=D1=8D?= =?UTF-8?q?=D0=BD?= <31664778+fir4tozden@users.noreply.github.com> Date: Sun, 14 Dec 2025 08:06:55 +0300 Subject: [PATCH 1/7] [BUG] fix: volume cleaning should not be performed --- packages/server/src/utils/docker/utils.ts | 44 +++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index d674a8840..a58ad441c 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -174,9 +174,9 @@ echo "Execution completed."`; const cleanupCommands = { containers: "docker container prune --force", images: "docker image prune --all --force", + volumes: "docker volume prune --all --force", builders: "docker builder prune --all --force", system: "docker system prune --all --force", - volumes: "docker volume prune --all --force", }; export const cleanupContainers = async (serverId?: string) => { @@ -257,24 +257,40 @@ export const cleanupSystem = async (serverId?: string) => { } }; +/** + * Volume cleanup should always be performed manually by the user. The reason is that during automatic cleanup, a volume may be deleted due to a stopped container, which is a dangerous situation. + * + * https://github.com/Dokploy/dokploy/pull/3266 + */ +const excludedCleanupAllCommands: (keyof typeof cleanupCommands)[] = ['volumes']; + export const cleanupAll = async (serverId?: string) => { - await cleanupContainers(serverId); - await cleanupImages(serverId); - await cleanupBuilders(serverId); - await cleanupSystem(serverId); + for (const [key, command] of Object.entries(cleanupCommands)) { + if (excludedCleanupAllCommands.includes(key)) continue; + + try { + if (serverId) { + await execAsyncRemote(serverId, dockerSafeExec(command)); + } else { + await execAsync(dockerSafeExec(command)); + } + } catch {} + } }; export const cleanupAllBackground = async (serverId?: string) => { Promise.allSettled( - Object.values(cleanupCommands).map(async (command) => { - try { - if (serverId) { - await execAsyncRemote(serverId, dockerSafeExec(command)); - } else { - await execAsync(dockerSafeExec(command)); - } - } catch (error) {} - }), + Object.entries(cleanupCommands) + .filter(([key]) => !excludedCleanupAllCommands.includes(key)) + .map(async ([, command]) => { + try { + if (serverId) { + await execAsyncRemote(serverId, dockerSafeExec(command)); + } else { + await execAsync(dockerSafeExec(command)); + } + } catch {} + }) ) .then((results) => { const failed = results.filter((r) => r.status === "rejected"); From ba5283039c669a3180df47cfeb9ffd34a85b1e02 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 14 Dec 2025 05:11:51 +0000 Subject: [PATCH 2/7] [autofix.ci] apply automated fixes --- packages/server/src/utils/docker/utils.ts | 46 ++++++++++++----------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index a58ad441c..565e15033 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -262,35 +262,37 @@ export const cleanupSystem = async (serverId?: string) => { * * https://github.com/Dokploy/dokploy/pull/3266 */ -const excludedCleanupAllCommands: (keyof typeof cleanupCommands)[] = ['volumes']; +const excludedCleanupAllCommands: (keyof typeof cleanupCommands)[] = [ + "volumes", +]; export const cleanupAll = async (serverId?: string) => { - for (const [key, command] of Object.entries(cleanupCommands)) { - if (excludedCleanupAllCommands.includes(key)) continue; + for (const [key, command] of Object.entries(cleanupCommands)) { + if (excludedCleanupAllCommands.includes(key)) continue; - try { - if (serverId) { - await execAsyncRemote(serverId, dockerSafeExec(command)); - } else { - await execAsync(dockerSafeExec(command)); - } - } catch {} - } + try { + if (serverId) { + await execAsyncRemote(serverId, dockerSafeExec(command)); + } else { + await execAsync(dockerSafeExec(command)); + } + } catch {} + } }; export const cleanupAllBackground = async (serverId?: string) => { Promise.allSettled( - Object.entries(cleanupCommands) - .filter(([key]) => !excludedCleanupAllCommands.includes(key)) - .map(async ([, command]) => { - try { - if (serverId) { - await execAsyncRemote(serverId, dockerSafeExec(command)); - } else { - await execAsync(dockerSafeExec(command)); - } - } catch {} - }) + Object.entries(cleanupCommands) + .filter(([key]) => !excludedCleanupAllCommands.includes(key)) + .map(async ([, command]) => { + try { + if (serverId) { + await execAsyncRemote(serverId, dockerSafeExec(command)); + } else { + await execAsync(dockerSafeExec(command)); + } + } catch {} + }), ) .then((results) => { const failed = results.filter((r) => r.status === "rejected"); From 51abf494585aa8c6be34e1619010a6b6ebcd995e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=84=D1=8B=D1=80=D0=B0=D1=82=20=D1=91=D0=B7=D0=B4=D1=8D?= =?UTF-8?q?=D0=BD?= <31664778+fir4tozden@users.noreply.github.com> Date: Sun, 14 Dec 2025 08:13:02 +0300 Subject: [PATCH 3/7] chore: update pr id --- packages/server/src/utils/docker/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index 565e15033..2a1674151 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -260,7 +260,7 @@ export const cleanupSystem = async (serverId?: string) => { /** * Volume cleanup should always be performed manually by the user. The reason is that during automatic cleanup, a volume may be deleted due to a stopped container, which is a dangerous situation. * - * https://github.com/Dokploy/dokploy/pull/3266 + * https://github.com/Dokploy/dokploy/pull/3267 */ const excludedCleanupAllCommands: (keyof typeof cleanupCommands)[] = [ "volumes", From 371cf83e52979621dfa226e084b98786a99ba0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=84=D1=8B=D1=80=D0=B0=D1=82=20=D1=91=D0=B7=D0=B4=D1=8D?= =?UTF-8?q?=D0=BD?= <31664778+fir4tozden@users.noreply.github.com> Date: Sun, 14 Dec 2025 08:16:09 +0300 Subject: [PATCH 4/7] fix: typing --- packages/server/src/utils/docker/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index 2a1674151..abd1f678c 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -267,7 +267,7 @@ const excludedCleanupAllCommands: (keyof typeof cleanupCommands)[] = [ ]; export const cleanupAll = async (serverId?: string) => { - for (const [key, command] of Object.entries(cleanupCommands)) { + for (const [key, command] of Object.entries(cleanupCommands) as [keyof typeof cleanupCommands, string][]) { if (excludedCleanupAllCommands.includes(key)) continue; try { From 669de0f95f79915e8d0faa7e61cdcc4628de5166 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 14 Dec 2025 05:16:30 +0000 Subject: [PATCH 5/7] [autofix.ci] apply automated fixes --- packages/server/src/utils/docker/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index abd1f678c..86e8ccb2f 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -267,7 +267,10 @@ const excludedCleanupAllCommands: (keyof typeof cleanupCommands)[] = [ ]; export const cleanupAll = async (serverId?: string) => { - for (const [key, command] of Object.entries(cleanupCommands) as [keyof typeof cleanupCommands, string][]) { + for (const [key, command] of Object.entries(cleanupCommands) as [ + keyof typeof cleanupCommands, + string, + ][]) { if (excludedCleanupAllCommands.includes(key)) continue; try { From b66156956ac4ff24f6fa7e6d2fa3a69aee3ecfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=84=D1=8B=D1=80=D0=B0=D1=82=20=D1=91=D0=B7=D0=B4=D1=8D?= =?UTF-8?q?=D0=BD?= <31664778+fir4tozden@users.noreply.github.com> Date: Sun, 14 Dec 2025 08:20:00 +0300 Subject: [PATCH 6/7] fix: typing --- packages/server/src/utils/docker/utils.ts | 53 ++++++++++++----------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index 86e8ccb2f..ab3dac173 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -284,33 +284,34 @@ export const cleanupAll = async (serverId?: string) => { }; export const cleanupAllBackground = async (serverId?: string) => { - Promise.allSettled( - Object.entries(cleanupCommands) - .filter(([key]) => !excludedCleanupAllCommands.includes(key)) - .map(async ([, command]) => { - try { - if (serverId) { - await execAsyncRemote(serverId, dockerSafeExec(command)); - } else { - await execAsync(dockerSafeExec(command)); - } - } catch {} - }), - ) - .then((results) => { - const failed = results.filter((r) => r.status === "rejected"); - if (failed.length > 0) { - console.error(`Docker cleanup: ${failed.length} operations failed`); - } else { - console.log("Docker cleanup completed successfully"); - } - }) - .catch((error) => console.error("Error in cleanup:", error)); + Promise.allSettled( + (Object.entries(cleanupCommands) as [ + keyof typeof cleanupCommands, + string + ][]) + .filter(([key]) => !excludedCleanupAllCommands.includes(key)) + .map(async ([, command]) => { + if (serverId) { + await execAsyncRemote(serverId, dockerSafeExec(command)); + } else { + await execAsync(dockerSafeExec(command)); + } + }) + ) + .then((results) => { + const failed = results.filter((r) => r.status === "rejected"); + if (failed.length > 0) { + console.error(`Docker cleanup: ${failed.length} operations failed`); + } else { + console.log("Docker cleanup completed successfully"); + } + }) + .catch((error) => console.error("Error in cleanup:", error)); - return { - status: "scheduled", - message: "Docker cleanup has been initiated in the background", - }; + return { + status: "scheduled", + message: "Docker cleanup has been initiated in the background", + }; }; export const startService = async (appName: string) => { From 2b1a3db7b89a94fed54031e581407200f802aaa8 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 14 Dec 2025 05:20:20 +0000 Subject: [PATCH 7/7] [autofix.ci] apply automated fixes --- packages/server/src/utils/docker/utils.ts | 56 ++++++++++++----------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/packages/server/src/utils/docker/utils.ts b/packages/server/src/utils/docker/utils.ts index ab3dac173..140960426 100644 --- a/packages/server/src/utils/docker/utils.ts +++ b/packages/server/src/utils/docker/utils.ts @@ -284,34 +284,36 @@ export const cleanupAll = async (serverId?: string) => { }; export const cleanupAllBackground = async (serverId?: string) => { - Promise.allSettled( - (Object.entries(cleanupCommands) as [ - keyof typeof cleanupCommands, - string - ][]) - .filter(([key]) => !excludedCleanupAllCommands.includes(key)) - .map(async ([, command]) => { - if (serverId) { - await execAsyncRemote(serverId, dockerSafeExec(command)); - } else { - await execAsync(dockerSafeExec(command)); - } - }) - ) - .then((results) => { - const failed = results.filter((r) => r.status === "rejected"); - if (failed.length > 0) { - console.error(`Docker cleanup: ${failed.length} operations failed`); - } else { - console.log("Docker cleanup completed successfully"); - } - }) - .catch((error) => console.error("Error in cleanup:", error)); + Promise.allSettled( + ( + Object.entries(cleanupCommands) as [ + keyof typeof cleanupCommands, + string, + ][] + ) + .filter(([key]) => !excludedCleanupAllCommands.includes(key)) + .map(async ([, command]) => { + if (serverId) { + await execAsyncRemote(serverId, dockerSafeExec(command)); + } else { + await execAsync(dockerSafeExec(command)); + } + }), + ) + .then((results) => { + const failed = results.filter((r) => r.status === "rejected"); + if (failed.length > 0) { + console.error(`Docker cleanup: ${failed.length} operations failed`); + } else { + console.log("Docker cleanup completed successfully"); + } + }) + .catch((error) => console.error("Error in cleanup:", error)); - return { - status: "scheduled", - message: "Docker cleanup has been initiated in the background", - }; + return { + status: "scheduled", + message: "Docker cleanup has been initiated in the background", + }; }; export const startService = async (appName: string) => {