From 68ba6ce5a1c4523bde3035e415f7396bd90d54be Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Fri, 9 Feb 2024 20:55:37 +0100 Subject: [PATCH] Docker client expects to be closed after usage in long running program --- cmd/backup/script.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/backup/script.go b/cmd/backup/script.go index fa9719f..b16d23b 100644 --- a/cmd/backup/script.go +++ b/cmd/backup/script.go @@ -112,6 +112,12 @@ func newScript(c *Config) (*script, error) { return nil, fmt.Errorf("newScript: failed to create docker client") } s.cli = cli + s.registerHook(hookLevelPlumbing, func(err error) error { + if err := s.cli.Close(); err != nil { + return fmt.Errorf("newScript: failed to close docker client: %w", err) + } + return nil + }) } logFunc := func(logType storage.LogLevel, context string, msg string, params ...any) {