Reuse docker client instance in plugin
Instead of creating a new one, reuse one created in weaver. The change removes the pinning of client API versions (1.21 in our case).
This commit is contained in:
1 parent
568290afb7
commit
332762201a
3 files changed
+5
-21
No files matched your search
+2
-19
@@ -20,31 +20,14 @@ import (
|
||||
|
||||
var Log = common.Log
|
||||
|
||||
func Start(weaveAPIAddr string, dockerAPIAddr string, address string, meshAddress string) {
|
||||
func Start(weaveAPIAddr string, dockerClient *docker.Client, address string, meshAddress string) {
|
||||
weave := weaveapi.NewClient(weaveAPIAddr, Log)
|
||||
|
||||
var dockerClient *docker.Client
|
||||
var err error
|
||||
if dockerAPIAddr != "" {
|
||||
// API 1.21 is the first version that supports docker network commands
|
||||
dockerClient, err = docker.NewVersionedClient(dockerAPIAddr, "1.21")
|
||||
if err != nil {
|
||||
Log.Fatalf("unable to connect to docker: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if dockerClient == nil {
|
||||
Log.Info("Running without Docker API connection")
|
||||
} else {
|
||||
Log.Info(dockerClient.Info())
|
||||
}
|
||||
|
||||
Log.Info("Waiting for Weave API Server...")
|
||||
weave.WaitAPIServer(30)
|
||||
Log.Info("Finished waiting for Weave API Server")
|
||||
|
||||
err = run(dockerClient, weave, address, meshAddress)
|
||||
if err != nil {
|
||||
if err := run(dockerClient, weave, address, meshAddress); err != nil {
|
||||
Log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user