diff --git a/containers_part1.go b/containers_part1.go index 6d37c01..3df0634 100644 --- a/containers_part1.go +++ b/containers_part1.go @@ -200,6 +200,8 @@ func setupContainers(config Config, clientTitle string, clientInfo *ClientInfo, if err := saveContainerPorts(containerDir, containerNum, resources, containerPorts); err != nil { log.Printf(" ⚠ Ошибка сохранения портов: %v", err) } + } else { + log.Printf(" ⚠ Контейнер %s не был пересоздан — будет повторная попытка при следующем запуске", containerFullName) } continue } @@ -243,7 +245,13 @@ func setupContainers(config Config, clientTitle string, clientInfo *ClientInfo, } } if !portsOK { - recreateContainer(containerFullName, composeFile, containerDir, clientTitle, resources, resourcePortMap, containerNum) + updateLockStatus(fmt.Sprintf("recreating container (ports): %s", containerFullName)) + success := recreateContainer(containerFullName, composeFile, containerDir, clientTitle, resources, resourcePortMap, containerNum) + if success { + if err := saveContainerPorts(containerDir, containerNum, resources, containerPorts); err != nil { + log.Printf(" ⚠ Ошибка сохранения портов: %v", err) + } + } continue } }