Skip to content

Commit cb64482

Browse files
committed
fix: inject COMPOSE_PROJECT_NAME to prevent orphaned containers on redeploy
When users set a custom docker compose command without the -p flag, Docker Compose defaults to using the directory name (code) as the project name. If the custom command is later removed, Dokploy uses -p appName, creating a new stack while the old one remains running. Injecting COMPOSE_PROJECT_NAME=appName into the .env ensures the project name is always consistent regardless of the command used. Closes #4019
1 parent f4cae5f commit cb64482

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

packages/server/src/utils/builders/compose.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const getCreateEnvFileCommand = (compose: ComposeNested) => {
106106
const envFilePath = join(dirname(composeFilePath), ".env");
107107

108108
let envContent = `APP_NAME=${appName}\n`;
109+
envContent += `COMPOSE_PROJECT_NAME=${appName}\n`;
109110
envContent += env || "";
110111
if (!envContent.includes("DOCKER_CONFIG")) {
111112
envContent += "\nDOCKER_CONFIG=/root/.docker";

0 commit comments

Comments
 (0)