Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions pkg/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,14 @@ func (c *ContainerClient) ImagePullWithRetries(ctx context.Context, imageRef str

// Note: ImagePull does not seem to return an error if the private registries authentication fails
// so after pulling the image, check if it is loaded to confirm everything worked as expected
useDockerPull := false
useDockerPull := true

// try podman api first and but fallback to docker pull API fails
// Note: Podman 4.4 was observed to have an issue pulling images via the docker API where the only reported error is:
// "write /dev/stderr: input/output error"
podmanLib := NewDefaultLibPodHTTPClient()
if podmanLib.Test(ctx) == nil {
slog.Info("Using podman API to pull image")
slog.Info("Trying to pull image using podman API")
libpodErr := podmanLib.PullImages(ctx, imageRef, alwaysPull, PodmanPullOptions{
PullOptions: pullOptions,
Quiet: false,
Expand All @@ -575,7 +575,9 @@ func (c *ContainerClient) ImagePullWithRetries(ctx context.Context, imageRef str
// and a check for the image is done afterwards anyway
if libpodErr != nil {
slog.Warn("podman (libpod) pull images failed but error will be ignored.", "err", libpodErr)
useDockerPull = true

} else {
useDockerPull = false
}
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/container/socket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,9 @@ func (c *SocketClient) PullImages(ctx context.Context, imageRef string, alwaysPu
}

slog.Info("Podman API response was successful.", "status", r.Status)
statusOK := r.StatusCode >= 200 && r.StatusCode < 400
if !statusOK {
return fmt.Errorf("podman api failed. code=%s", r.Status)
}
return nil
}