diff --git a/backend/app/service/container.go b/backend/app/service/container.go index f641db2d9..fde34c9db 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -7,6 +7,7 @@ import ( "io" "os" "os/exec" + "path/filepath" "sort" "strconv" "strings" @@ -421,15 +422,17 @@ func (u *ContainerService) ContainerUpdate(req dto.ContainerOperate) error { global.LOG.Errorf("force pull image %s failed, err: %v", req.Image, err) } } + + if err := client.ContainerRemove(ctx, req.ContainerID, types.ContainerRemoveOptions{Force: true}); err != nil { + return err + } + config := oldContainer.Config hostConf := oldContainer.HostConfig var networkConf network.NetworkingConfig if err := loadConfigInfo(req, config, hostConf, &networkConf); err != nil { return err } - if err := client.ContainerRemove(ctx, req.ContainerID, types.ContainerRemoveOptions{Force: true}); err != nil { - return err - } global.LOG.Infof("new container info %s has been update, now start to recreate", req.Name) container, err := client.ContainerCreate(ctx, config, hostConf, &networkConf, &v1.Platform{}, req.Name) @@ -540,6 +543,11 @@ func (u *ContainerService) ContainerLogClean(req dto.OperationWithName) error { return err } _, _ = file.Seek(0, 0) + + files, _ := filepath.Glob(fmt.Sprintf("%s.*", container.LogPath)) + for _, file := range files { + _ = os.Remove(file) + } return nil } diff --git a/backend/app/service/monitor.go b/backend/app/service/monitor.go index 3fa543923..320b20134 100644 --- a/backend/app/service/monitor.go +++ b/backend/app/service/monitor.go @@ -148,10 +148,16 @@ func loadNetIO() { if net2.BytesSent != 0 && net1.BytesSent != 0 { itemNet.Up = float64(net2.BytesSent-net1.BytesSent) / 1024 / 60 } + if itemNet.Up > 100000000 { + global.LOG.Errorf("net2: %v, net1: %v, BytesSent: %v \n", net2.BytesSent, net1.BytesSent, float64(net2.BytesSent-net1.BytesSent)/1024/60) + } if net2.BytesRecv != 0 && net1.BytesRecv != 0 { itemNet.Down = float64(net2.BytesRecv-net1.BytesRecv) / 1024 / 60 } + if itemNet.Down > 100000000 { + global.LOG.Errorf("net2: %v, net1: %v, BytesRecv: %v \n", net2.BytesRecv, net1.BytesRecv, float64(net2.BytesRecv-net1.BytesRecv)/1024/60) + } netList = append(netList, itemNet) break } diff --git a/frontend/src/components/container-log/index.vue b/frontend/src/components/container-log/index.vue index 962ab181d..71514465a 100644 --- a/frontend/src/components/container-log/index.vue +++ b/frontend/src/components/container-log/index.vue @@ -92,7 +92,7 @@ const timeOptions = ref([ ]); const searchLogs = async () => { - if (!Number(logSearch.tail) || Number(logSearch.tail) <= 0) { + if (!Number(logSearch.tail) || Number(logSearch.tail) < 0) { MsgError(i18n.global.t('container.linesHelper')); return; } diff --git a/frontend/src/components/port-jump/index.vue b/frontend/src/components/port-jump/index.vue index 2a140ccd1..61d7ea154 100644 --- a/frontend/src/components/port-jump/index.vue +++ b/frontend/src/components/port-jump/index.vue @@ -47,6 +47,7 @@ const acceptParams = async (params: DialogProps): Promise => { } if (!checkIp(res.data.systemIP)) { window.open(`http://${res.data.systemIP}:${params.port}`, '_blank'); + return; } window.open(`http://[${res.data.systemIP}]:${params.port}`, '_blank'); }; diff --git a/frontend/src/views/container/container/log/index.vue b/frontend/src/views/container/container/log/index.vue index b9e55b571..d32d4d8ca 100644 --- a/frontend/src/views/container/container/log/index.vue +++ b/frontend/src/views/container/container/log/index.vue @@ -134,7 +134,7 @@ watch(logVisiable, (val) => { if (screenfull.isEnabled && !val && !mobile.value) screenfull.exit(); }); const searchLogs = async () => { - if (!Number(logSearch.tail) || Number(logSearch.tail) <= 0) { + if (!Number(logSearch.tail) || Number(logSearch.tail) < 0) { MsgError(i18n.global.t('container.linesHelper')); return; }