diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 64ba3f4f5..2ab9f5a76 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -316,11 +316,6 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error { return buserr.New(constant.ErrContainerName) } - config, hostConf, networkConf, err := loadConfigInfo(true, req, nil) - if err != nil { - return err - } - global.LOG.Infof("new container info %s has been made, now start to create", req.Name) if !checkImageExist(client, req.Image) || req.ForcePull { if err := pullImages(ctx, client, req.Image); err != nil { if !req.ForcePull { @@ -329,6 +324,18 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error { global.LOG.Errorf("force pull image %s failed, err: %v", req.Image, err) } } + imageInfo, _, err := client.ImageInspectWithRaw(ctx, req.Image) + if err != nil { + return err + } + if len(req.Entrypoint) == 0 { + req.Entrypoint = imageInfo.Config.Entrypoint + } + config, hostConf, networkConf, err := loadConfigInfo(true, req, nil) + if err != nil { + return err + } + global.LOG.Infof("new container info %s has been made, now start to create", req.Name) container, err := client.ContainerCreate(ctx, config, hostConf, networkConf, &v1.Platform{}, req.Name) if err != nil { _ = client.ContainerRemove(ctx, req.Name, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true})