From f2350d0a65cbf4a8fa0c0c12e0fa0770894f519d Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:30:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=8B=89=E5=8F=96=E6=88=90=E5=8A=9F=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E5=AE=B9=E5=99=A8=E8=A2=AB=E5=88=A0=E9=99=A4=20(#5525?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_utils.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index 8afe96ff3..1a2de3bb3 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -14,6 +14,7 @@ import ( "regexp" "strconv" "strings" + "time" "github.com/docker/docker/api/types" @@ -610,17 +611,13 @@ func upgradeInstall(req request.AppInstallUpgrade) error { upErr = err return } - dockerCli, err := composeV2.NewClient() - if err != nil { - upErr = err - return - } - defer dockerCli.Close() for _, image := range images { global.LOG.Infof(i18n.GetMsgWithName("PullImageStart", image, nil)) - if err = dockerCli.PullImage(image, true); err != nil { + if out, err := cmd.ExecWithTimeOut("docker pull "+image, 20*time.Minute); err != nil { + if out != "" { + err = errors.New(out) + } upErr = buserr.WithNameAndErr("ErrDockerPullImage", "", err) - return } else { global.LOG.Infof(i18n.GetMsgByKey("PullImageSuccess")) }