fix: replace stopped platform containers
This commit is contained in:
@@ -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)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user