1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

fix: Fix Issue with Podman Unable to Create PHP Runtime Website (#7253)

This commit is contained in:
zhengkunwang 2024-12-03 19:01:05 +08:00 committed by GitHub
parent 8e3a06b07f
commit d8fd430856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 6 deletions

View File

@ -983,6 +983,25 @@ func checkImageExist(client *client.Client, imageItem string) bool {
return false
}
func checkImageLike(imageName string) bool {
cli, err := docker.NewDockerClient()
if err != nil {
return false
}
images, err := cli.ImageList(context.Background(), image.ListOptions{})
if err != nil {
return false
}
for _, img := range images {
for _, tag := range img.RepoTags {
if strings.Contains(tag, imageName) {
return true
}
}
}
return false
}
func pullImages(ctx context.Context, client *client.Client, imageName string) error {
options := image.PullOptions{}
repos, _ := imageRepoRepo.List()

View File

@ -313,12 +313,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
switch runtime.Type {
case constant.RuntimePHP:
if runtime.Resource == constant.ResourceAppstore {
client, err := docker.NewDockerClient()
if err != nil {
return err
}
defer client.Close()
if !checkImageExist(client, runtime.Image) {
if !checkImageLike(runtime.Image) {
return buserr.WithName("ErrImageNotExist", runtime.Name)
}
var (