Close docker client (#789)

* Close docker client!

* Fix nil dereference

* Update run_context.go

* Bump

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
ChristopherHXandmergify[bot] authored and GitHub committed 2021-10-24 16:50:43 +00:00
1 parent f8ddfca6f7
commit 83a28d9512
7 files changed
+24 -3

No files matched your search

+11
View File
@@ -76,6 +76,7 @@ type Container interface {
UpdateFromImageEnv(env *map[string]string) common.Executor
UpdateFromPath(env *map[string]string) common.Executor
Remove() common.Executor
Close() common.Executor
}
// NewContainer creates a reference to a container
@@ -246,6 +247,16 @@ func (cr *containerReference) connect() common.Executor {
}
}
func (cr *containerReference) Close() common.Executor {
return func(ctx context.Context) error {
if cr.cli != nil {
cr.cli.Close()
cr.cli = nil
}
return nil
}
}
func (cr *containerReference) find() common.Executor {
return func(ctx context.Context) error {
if cr.id != "" {