2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

fix: 容器镜像不存在自动拉取

This commit is contained in:
2025-11-23 04:00:27 +08:00
parent f5147eb3e6
commit 0fc595c723
2 changed files with 13 additions and 0 deletions

View File

@@ -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,

View File

@@ -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())
}