From d3e4d56a0da3395bf50aa9fa66055aeff5911f9b Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 31 Aug 2022 18:04:08 +0200 Subject: [PATCH] Fix Docker provider mem leak on operation retries Co-authored-by: Mathieu Lonjaret --- pkg/provider/docker/docker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/provider/docker/docker.go b/pkg/provider/docker/docker.go index eda5318fc..6de001275 100644 --- a/pkg/provider/docker/docker.go +++ b/pkg/provider/docker/docker.go @@ -205,6 +205,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. logger.Errorf("Failed to create a client for docker, error: %s", err) return err } + defer dockerClient.Close() serverVersion, err := dockerClient.ServerVersion(ctx) if err != nil { @@ -249,7 +250,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. case <-ticker.C: services, err := p.listServices(ctx, dockerClient) if err != nil { - logger.Errorf("Failed to list services for docker, error %s", err) + logger.Errorf("Failed to list services for docker swarm mode, error %s", err) errChan <- err return }