From 18d5ef3db1d452825ee2228885d192d3db6ac9de Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Tue, 8 Apr 2025 13:03:21 +0200 Subject: [PATCH] fix(container): do not error on pull image failure --- internal/container/container.go | 4 +--- internal/container/container_test.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/container/container.go b/internal/container/container.go index 8e254d4..960a78d 100644 --- a/internal/container/container.go +++ b/internal/container/container.go @@ -178,9 +178,7 @@ func (a *Client) RunContainer(ctx context.Context, params RunContainerParams) (< defer close(errC) if err := a.pullImageIfNeeded(ctx, params.ContainerConfig.Image, containerStateC); err != nil { - a.logger.Error("Error pulling image", "err", err) - sendError(fmt.Errorf("image pull: %w", err)) - return + a.logger.Warn("Error pulling image", "err", err) } containerConfig := *params.ContainerConfig diff --git a/internal/container/container_test.go b/internal/container/container_test.go index 6d8065c..c8fe53c 100644 --- a/internal/container/container_test.go +++ b/internal/container/container_test.go @@ -44,7 +44,7 @@ func TestClientRunContainer(t *testing.T) { dockerClient. EXPECT(). 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. EXPECT(). ContainerCreate(mock.Anything, mock.Anything, mock.Anything, mock.Anything, (*ocispec.Platform)(nil), mock.Anything).