1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package main import ( "github.com/docker/docker/client" "context" ) var ( dockerCtx context.Context dockerCli *client.Client ) func setupContext() { if dockerCtx == nil { dockerCtx = context.Background() } } func setupDockerCLI() (err error) { if dockerCli == nil { dockerCli, err = client.NewEnvClient() } return err }