mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix: handle race condition to catch recreation base containers
This commit is contained in:
parent
3a7bb5016c
commit
871931b460
@ -54,10 +54,16 @@ export const initializePostgres = async () => {
|
|||||||
version: Number.parseInt(inspect.Version.Index),
|
version: Number.parseInt(inspect.Version.Index),
|
||||||
...settings,
|
...settings,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Postgres Started ✅");
|
console.log("Postgres Started ✅");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await docker.createService(settings);
|
try {
|
||||||
|
await docker.createService(settings);
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error?.statusCode !== 409) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
console.log("Postgres service already exists, continuing...");
|
||||||
|
}
|
||||||
console.log("Postgres Not Found: Starting ✅");
|
console.log("Postgres Not Found: Starting ✅");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,14 @@ export const initializeRedis = async () => {
|
|||||||
});
|
});
|
||||||
console.log("Redis Started ✅");
|
console.log("Redis Started ✅");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await docker.createService(settings);
|
try {
|
||||||
|
await docker.createService(settings);
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error?.statusCode !== 409) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
console.log("Redis service already exists, continuing...");
|
||||||
|
}
|
||||||
console.log("Redis Not Found: Starting ✅");
|
console.log("Redis Not Found: Starting ✅");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -128,7 +128,14 @@ export const initializeTraefik = async ({
|
|||||||
|
|
||||||
console.log("Traefik Started ✅");
|
console.log("Traefik Started ✅");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await docker.createService(settings);
|
try {
|
||||||
|
await docker.createService(settings);
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error?.statusCode !== 409) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
console.log("Traefik service already exists, continuing...");
|
||||||
|
}
|
||||||
console.log("Traefik Not Found: Starting ✅");
|
console.log("Traefik Not Found: Starting ✅");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user