From 6f8fb9ee5de686af0f001fffa74c7c1343601c33 Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Mon, 26 Aug 2019 14:29:17 -0400 Subject: [PATCH] add WithImageName container opt Signed-off-by: Evan Hazlett --- container_opts.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/container_opts.go b/container_opts.go index e36b47e2e..23e77492e 100644 --- a/container_opts.go +++ b/container_opts.go @@ -78,6 +78,14 @@ func WithImage(i Image) NewContainerOpts { } } +// WithImageName allows setting the image name as the base for the container +func WithImageName(n string) NewContainerOpts { + return func(ctx context.Context, _ *Client, c *containers.Container) error { + c.Image = n + return nil + } +} + // WithContainerLabels adds the provided labels to the container func WithContainerLabels(labels map[string]string) NewContainerOpts { return func(_ context.Context, _ *Client, c *containers.Container) error {