From 0fc595c7234d0d4753d02d4eecd88a8ec0242ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sun, 23 Nov 2025 04:00:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=B9=E5=99=A8=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E8=87=AA=E5=8A=A8=E6=8B=89=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/data/container.go | 12 ++++++++++++ internal/data/container_image.go | 1 + 2 files changed, 13 insertions(+) diff --git a/internal/data/container.go b/internal/data/container.go index 02673e27..4c20065c 100644 --- a/internal/data/container.go +++ b/internal/data/container.go @@ -100,6 +100,18 @@ func (r *containerRepo) Create(req *request.ContainerCreate) (string, error) { ctx := context.Background() + // 拉取镜像 + out, err := apiClient.ImagePull(ctx, req.Name, client.ImagePullOptions{}) + if err != nil { + return "", err + } + defer func(out client.ImagePullResponse) { _ = out.Close() }(out) + + // TODO 实现流式显示拉取进度 + if err = out.Wait(ctx); err != nil { + return "", err + } + // 构建容器配置 config := &container.Config{ Image: req.Image, diff --git a/internal/data/container_image.go b/internal/data/container_image.go index f4595b62..5e9879e1 100644 --- a/internal/data/container_image.go +++ b/internal/data/container_image.go @@ -86,6 +86,7 @@ func (r *containerImageRepo) Pull(req *request.ContainerImagePull) error { } defer func(out client.ImagePullResponse) { _ = out.Close() }(out) + // TODO 实现流式显示拉取进度 return out.Wait(context.Background()) }