@@ -17,7 +17,6 @@ import (
1717 "strings"
1818 "time"
1919
20- "github.com/docker/docker/api/types"
2120 "github.com/docker/docker/api/types/container"
2221 "github.com/docker/docker/client"
2322 "github.com/golang/glog"
@@ -151,7 +150,7 @@ func (in ContainerInstance) bestEffortTryLogin() error {
151150 return nil
152151 }
153152 if strings .Contains (err .Error (), "Client sent an HTTP request to an HTTPS server." ) {
154- // This is TLS enabled cluster. We won't be able to login .
153+ // This is a TLS enabled cluster. We won't be able to log in .
155154 return nil
156155 }
157156 fmt .Printf ("login failed for %s: %v. Retrying...\n " , in , err )
@@ -161,21 +160,21 @@ func (in ContainerInstance) bestEffortTryLogin() error {
161160 return fmt .Errorf ("unable to login to %s" , in )
162161}
163162
164- func (in ContainerInstance ) GetContainer () * types. Container {
163+ func (in ContainerInstance ) GetContainer () * container. Summary {
165164 containers := AllContainers (in .Prefix )
166165
167166 q := fmt .Sprintf ("/%s_%s_" , in .Prefix , in .Name )
168- for _ , container := range containers {
169- for _ , name := range container .Names {
167+ for _ , c := range containers {
168+ for _ , name := range c .Names {
170169 if strings .HasPrefix (name , q ) {
171- return & container
170+ return & c
172171 }
173172 }
174173 }
175174 return nil
176175}
177176
178- func getContainer (name string ) types. Container {
177+ func getContainer (name string ) container. Summary {
179178 cli , err := client .NewClientWithOpts (client .FromEnv , client .WithAPIVersionNegotiation ())
180179 x .Check (err )
181180
@@ -193,10 +192,10 @@ func getContainer(name string) types.Container {
193192 return c
194193 }
195194 }
196- return types. Container {}
195+ return container. Summary {}
197196}
198197
199- func AllContainers (prefix string ) []types. Container {
198+ func AllContainers (prefix string ) []container. Summary {
200199 cli , err := client .NewClientWithOpts (client .FromEnv , client .WithAPIVersionNegotiation ())
201200 x .Check (err )
202201
@@ -205,7 +204,7 @@ func AllContainers(prefix string) []types.Container {
205204 log .Fatalf ("While listing container: %v\n " , err )
206205 }
207206
208- var out []types. Container
207+ var out []container. Summary
209208 for _ , c := range containers {
210209 for _ , name := range c .Names {
211210 if strings .HasPrefix (name , "/" + prefix ) {
@@ -234,7 +233,7 @@ func ContainerAddr(name string, privatePort uint16) string {
234233 return ContainerAddrWithHost (name , privatePort , "0.0.0.0" )
235234}
236235
237- // DockerStart starts the specified services .
236+ // DockerRun performs the specified operation on the given container instance .
238237func DockerRun (instance string , op int ) error {
239238 c := getContainer (instance )
240239 if c .ID == "" {
@@ -299,7 +298,7 @@ func DockerExec(instance string, cmd ...string) error {
299298 return Exec (argv ... )
300299}
301300
302- func DockerInspect (containerID string ) (types. ContainerJSON , error ) {
301+ func DockerInspect (containerID string ) (container. InspectResponse , error ) {
303302 cli , err := client .NewClientWithOpts (client .FromEnv , client .WithAPIVersionNegotiation ())
304303 x .Check (err )
305304 return cli .ContainerInspect (context .Background (), containerID )
0 commit comments