fix(container): do not error on pull image failure

This commit is contained in:
Rob Watson 2025-04-08 13:03:21 +02:00
parent 1e759b6f42
commit 18d5ef3db1
2 changed files with 2 additions and 4 deletions

View File

@ -178,9 +178,7 @@ func (a *Client) RunContainer(ctx context.Context, params RunContainerParams) (<
defer close(errC) defer close(errC)
if err := a.pullImageIfNeeded(ctx, params.ContainerConfig.Image, containerStateC); err != nil { if err := a.pullImageIfNeeded(ctx, params.ContainerConfig.Image, containerStateC); err != nil {
a.logger.Error("Error pulling image", "err", err) a.logger.Warn("Error pulling image", "err", err)
sendError(fmt.Errorf("image pull: %w", err))
return
} }
containerConfig := *params.ContainerConfig containerConfig := *params.ContainerConfig

View File

@ -44,7 +44,7 @@ func TestClientRunContainer(t *testing.T) {
dockerClient. dockerClient.
EXPECT(). EXPECT().
ImagePull(mock.Anything, "alpine", image.PullOptions{}). ImagePull(mock.Anything, "alpine", image.PullOptions{}).
Return(io.NopCloser(bytes.NewReader(nil)), nil) Return(io.NopCloser(bytes.NewReader(nil)), errors.New("error pulling image should not be fatal"))
dockerClient. dockerClient.
EXPECT(). EXPECT().
ContainerCreate(mock.Anything, mock.Anything, mock.Anything, mock.Anything, (*ocispec.Platform)(nil), mock.Anything). ContainerCreate(mock.Anything, mock.Anything, mock.Anything, mock.Anything, (*ocispec.Platform)(nil), mock.Anything).