mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-10 11:40:53 +08:00
Fix Issue with Podman Unable to Create PHP Runtime Website (#9697)
* Update website.go * Update container.go
This commit is contained in:
parent
0828804de2
commit
2758ab07dc
2 changed files with 20 additions and 1 deletions
|
|
@ -1240,6 +1240,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(task *task.Task, client *client.Client, imageName string) error {
|
||||
dockerCli := docker.NewClientWithExist(client)
|
||||
options := image.PullOptions{}
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
|
|||
switch runtime.Type {
|
||||
case constant.RuntimePHP:
|
||||
if runtime.Resource == constant.ResourceAppstore {
|
||||
if !checkImageExist(nil, runtime.Image) {
|
||||
if !checkImageLike(runtime.Image) {
|
||||
return buserr.WithName("ErrImageNotExist", runtime.Name)
|
||||
}
|
||||
website.Proxy = fmt.Sprintf("127.0.0.1:%s", runtime.Port)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue