fix: replace stopped platform containers

This commit is contained in:
2026-04-29 07:39:42 +00:00
parent 63c6fb4b6a
commit 69b528a499
+3 -2
View File
@@ -935,8 +935,9 @@ export class OneboxDockerManager {
logger.info(`Pulling image for platform service: ${options.image}`);
await this.pullImage(options.image);
// Check if container already exists
const existingContainers = await this.dockerClient!.listContainers();
// Check running and stopped containers; stopped platform containers still reserve names.
const existingContainersResponse = await this.dockerClient!.request('GET', '/containers/json?all=true', {});
const existingContainers = Array.isArray(existingContainersResponse.body) ? existingContainersResponse.body : [];
const existing = existingContainers.find((c: any) =>
c.Names?.some((n: string) => n === `/${options.name}` || n === options.name)
);