diff --git a/agent/app/service/snapshot_create.go b/agent/app/service/snapshot_create.go index c5095d27b..c290bed40 100644 --- a/agent/app/service/snapshot_create.go +++ b/agent/app/service/snapshot_create.go @@ -370,7 +370,7 @@ func snapAppImage(snap snapHelper, req dto.SnapshotCreate, targetDir string) err snap.Task.Log(strings.Join(imageList, " ")) if len(imageList) != 0 { snap.Task.Logf("docker save %s | gzip -c > %s", strings.Join(imageList, " "), path.Join(targetDir, "images.tar.gz")) - std, err := cmd.RunDefaultWithStdoutBashCf("docker save %s | gzip -c > %s", strings.Join(imageList, " "), path.Join(targetDir, "images.tar.gz")) + std, err := cmd.NewCommandMgr(cmd.WithTimeout(10*time.Minute)).RunWithStdoutBashCf("docker save %s | gzip -c > %s", strings.Join(imageList, " "), path.Join(targetDir, "images.tar.gz")) if err != nil { snap.Task.LogFailedWithErr(i18n.GetMsgByKey("SnapDockerSave"), errors.New(std)) return errors.New(std) diff --git a/agent/app/service/snapshot_recover.go b/agent/app/service/snapshot_recover.go index 4868afe58..d62144ab0 100644 --- a/agent/app/service/snapshot_recover.go +++ b/agent/app/service/snapshot_recover.go @@ -6,6 +6,7 @@ import ( "os" "path" "strings" + "time" "github.com/1Panel-dev/1Panel/agent/app/repo" @@ -314,7 +315,7 @@ func recoverAppData(src string, itemHelper *snapRecoverHelper) error { itemHelper.Task.Log(i18n.GetMsgByKey("RecoverAppEmpty")) return nil } - std, err := cmd.RunDefaultWithStdoutBashCf("docker load < %s", path.Join(src, "images.tar.gz")) + std, err := cmd.NewCommandMgr(cmd.WithTimeout(10*time.Minute)).RunWithStdoutBashCf("docker load < %s", path.Join(src, "images.tar.gz")) if err != nil { itemHelper.Task.LogFailedWithErr(i18n.GetMsgByKey("RecoverAppImage"), errors.New(std)) return fmt.Errorf("docker load images failed, err: %v", err)