Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions agent/app/service/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down