Docker client expects to be closed after usage in long running program

This commit is contained in:
Frederik Ring 2024-02-09 20:55:37 +01:00
parent 65626dd3d4
commit de03d4f704

View File

@ -112,6 +112,12 @@ func newScript(c *Config) (*script, error) {
return nil, fmt.Errorf("newScript: failed to create docker client") return nil, fmt.Errorf("newScript: failed to create docker client")
} }
s.cli = cli 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) { logFunc := func(logType storage.LogLevel, context string, msg string, params ...any) {