From d76057210af8f999fb766b18fd56066197dc35fd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 10 Apr 2025 11:39:24 +0200 Subject: [PATCH] cli/command/container: use lazyregexp to compile regexes on first use Signed-off-by: Sebastiaan van Stijn --- cli/command/container/opts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index badb1b2a6b..017503a7f3 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -8,12 +8,12 @@ import ( "path" "path/filepath" "reflect" - "regexp" "strconv" "strings" "time" "github.com/docker/cli/cli/compose/loader" + "github.com/docker/cli/internal/lazyregexp" "github.com/docker/cli/opts" "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" @@ -40,7 +40,7 @@ const ( seccompProfileUnconfined = "unconfined" ) -var deviceCgroupRuleRegexp = regexp.MustCompile(`^[acb] ([0-9]+|\*):([0-9]+|\*) [rwm]{1,3}$`) +var deviceCgroupRuleRegexp = lazyregexp.New(`^[acb] ([0-9]+|\*):([0-9]+|\*) [rwm]{1,3}$`) // containerOptions is a data object with all the options for creating a container type containerOptions struct {