Skip to content

Commit

Permalink
Add OCI Volume Source support
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Jul 17, 2024
1 parent a6a89f6 commit bd276bf
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,21 @@ func CreateContainer(
}

// Try to pull the image before container creation
ann := config.GetImage().GetAnnotations()
if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, ann, opts.pullOptions.timeout); err != nil {
return "", err
images := []string{image}
logrus.Infof("Pulling container image: %s", image)

// Add possible OCI volume mounts
for _, m := range config.Mounts {
if m.Image != nil && m.Image.Image != "" {
logrus.Infof("Pulling image %s to be mounted to container path: %s", image, m.ContainerPath)
images = append(images, m.Image.Image)
}
}

for _, image := range images {
if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, config.GetImage().GetAnnotations(), opts.pullOptions.timeout); err != nil {
return "", err
}
}
}

Expand Down

0 comments on commit bd276bf

Please sign in to comment.