diff --git a/backend/app/service/app.go b/backend/app/service/app.go index 0f5e19d8e..2f557060d 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -445,13 +445,6 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) ( } appInstall.Env = string(paramByte) - containerNames, err := getContainerNames(*appInstall) - if err != nil { - return - } - if len(containerNames) > 0 { - appInstall.ContainerName = strings.Join(containerNames, ",") - } if err = appInstallRepo.Create(ctx, appInstall); err != nil { return } diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index dd06c8737..80c740109 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -943,6 +943,13 @@ func upApp(appInstall *model.AppInstall, pullImages bool) { } exist, _ := appInstallRepo.GetFirst(commonRepo.WithByID(appInstall.ID)) if exist.ID > 0 { + containerNames, err := getContainerNames(*appInstall) + if err != nil { + return + } + if len(containerNames) > 0 { + appInstall.ContainerName = strings.Join(containerNames, ",") + } _ = appInstallRepo.Save(context.Background(), appInstall) } }