mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-18 18:05:18 +00:00
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
This commit is contained in:
@@ -395,16 +395,14 @@ export const removeCompose = async (
|
|||||||
if (compose.composeType === "stack") {
|
if (compose.composeType === "stack") {
|
||||||
const command = `
|
const command = `
|
||||||
docker network disconnect ${compose.appName} dokploy-traefik;
|
docker network disconnect ${compose.appName} dokploy-traefik;
|
||||||
cd ${projectPath} && docker stack rm ${compose.appName} && rm -rf ${projectPath}`;
|
docker stack rm ${compose.appName};
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
await execAsync(command, {
|
|
||||||
cwd: projectPath,
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const command = `
|
const command = `
|
||||||
docker network disconnect ${compose.appName} dokploy-traefik;
|
docker network disconnect ${compose.appName} dokploy-traefik;
|
||||||
|
|||||||
Reference in New Issue
Block a user