fix: prevent orphaned containers when deleting compose services

Commands were chained with && so if the project directory was missing,
cd would fail and docker compose down would never execute — leaving
containers and volumes running. Use semicolons to run each command
independently, matching the existing stack deletion pattern.

Closes #4064
This commit is contained in:
Mauricio Siu
2026-04-09 16:25:36 -06:00
parent c1b19376a9
commit 825e6b654c
+5 -6
View File
@@ -440,17 +440,16 @@ export const removeCompose = async (
} }
} else { } else {
const command = ` const command = `
docker network disconnect ${compose.appName} dokploy-traefik; docker network disconnect ${compose.appName} dokploy-traefik;
cd ${projectPath} && env -i PATH="$PATH" docker compose -p ${compose.appName} down ${ env -i PATH="$PATH" docker compose -p ${compose.appName} down ${
deleteVolumes ? "--volumes" : "" deleteVolumes ? "--volumes" : ""
} && rm -rf ${projectPath}`; };
rm -rf ${projectPath}`;
if (compose.serverId) { if (compose.serverId) {
await execAsyncRemote(compose.serverId, command); await execAsyncRemote(compose.serverId, command);
} else { } else {
await execAsync(command, { await execAsync(command);
cwd: projectPath,
});
} }
} }
} catch (error) { } catch (error) {