From b5e583bfe93015838dc0dcd72f3a05edcccd6db6 Mon Sep 17 00:00:00 2001 From: Ric Featherstone Date: Tue, 21 Nov 2023 09:21:59 +0000 Subject: [PATCH] feat(container): add image pull --- internal/container/runner.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/container/runner.go b/internal/container/runner.go index 194fc682..42d12f10 100644 --- a/internal/container/runner.go +++ b/internal/container/runner.go @@ -61,6 +61,18 @@ func (r simulator) Run(ctx context.Context, command []string) error { return errors.Join(errors.New("failed to create docker client"), err) } + out, err := cli.ImagePull(ctx, r.Config.Container.Image, types.ImagePullOptions{}) + if err != nil { + return errors.Join(errors.New("failed to pull image"), err) + } + defer func(out io.ReadCloser) { + _ = out.Close() + }(out) + + if _, err = io.Copy(os.Stdout, out); err != nil { + return errors.Join(errors.New("failed to pull image"), err) + } + mounts := []mount.Mount{ { Type: mount.TypeBind,