Skip to content

Commit 2758ab0

Browse files
authored
Fix Issue with Podman Unable to Create PHP Runtime Website (#9697)
* Update website.go * Update container.go
1 parent 0828804 commit 2758ab0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

agent/app/service/container.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,25 @@ func checkImageExist(client *client.Client, imageItem string) bool {
12401240
return false
12411241
}
12421242

1243+
func checkImageLike(imageName string) bool {
1244+
cli, err := docker.NewDockerClient()
1245+
if err != nil {
1246+
return false
1247+
}
1248+
images, err := cli.ImageList(context.Background(), image.ListOptions{})
1249+
if err != nil {
1250+
return false
1251+
}
1252+
for _, img := range images {
1253+
for _, tag := range img.RepoTags {
1254+
if strings.Contains(tag, imageName) {
1255+
return true
1256+
}
1257+
}
1258+
}
1259+
return false
1260+
}
1261+
12431262
func pullImages(task *task.Task, client *client.Client, imageName string) error {
12441263
dockerCli := docker.NewClientWithExist(client)
12451264
options := image.PullOptions{}

agent/app/service/website.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
388388
switch runtime.Type {
389389
case constant.RuntimePHP:
390390
if runtime.Resource == constant.ResourceAppstore {
391-
if !checkImageExist(nil, runtime.Image) {
391+
if !checkImageLike(runtime.Image) {
392392
return buserr.WithName("ErrImageNotExist", runtime.Name)
393393
}
394394
website.Proxy = fmt.Sprintf("127.0.0.1:%s", runtime.Port)

0 commit comments

Comments
 (0)