Skip to content

Commit 343a84d

Browse files
committed
fix: prevent orphaned docker stacks when compose directory is missing
`docker stack rm` was chained after `cd` with `&&`, so if the compose directory didn't exist the stack removal command never executed. This left orphaned Docker services with occupied ports after deletion via the API. Also removed a duplicate `execAsync` call that always ran outside the `if/else` block regardless of `compose.serverId`. Fixes #3691
1 parent 89416fe commit 343a84d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/server/src/services/compose.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,16 +395,14 @@ export const removeCompose = async (
395395
if (compose.composeType === "stack") {
396396
const command = `
397397
docker network disconnect ${compose.appName} dokploy-traefik;
398-
cd ${projectPath} && docker stack rm ${compose.appName} && rm -rf ${projectPath}`;
398+
docker stack rm ${compose.appName};
399+
rm -rf ${projectPath}`;
399400

400401
if (compose.serverId) {
401402
await execAsyncRemote(compose.serverId, command);
402403
} else {
403404
await execAsync(command);
404405
}
405-
await execAsync(command, {
406-
cwd: projectPath,
407-
});
408406
} else {
409407
const command = `
410408
docker network disconnect ${compose.appName} dokploy-traefik;

0 commit comments

Comments
 (0)