Skip to content
Snippets Groups Projects
Commit 711caeab authored by ale's avatar ale
Browse files

Use docker client InspectContainerWithOptions()

Instead of the deprecated form InspectContainer().
parent 8df2f5b4
No related branches found
No related tags found
No related merge requests found
...@@ -159,7 +159,8 @@ func lookupNamedContainer(c *Context) error { ...@@ -159,7 +159,8 @@ func lookupNamedContainer(c *Context) error {
return err return err
} }
container, err := client.InspectContainer(c.Name) container, err := client.InspectContainerWithOptions(
dockerClient.InspectContainerOptions{ID: c.Name})
if _, ok := err.(*dockerClient.NoSuchContainer); ok { if _, ok := err.(*dockerClient.NoSuchContainer); ok {
return nil return nil
} }
...@@ -186,7 +187,8 @@ func lookupNamedContainer(c *Context) error { ...@@ -186,7 +187,8 @@ func lookupNamedContainer(c *Context) error {
return err return err
} }
container, err = client.InspectContainer(c.Name) container, err = client.InspectContainerWithOptions(
dockerClient.InspectContainerOptions{ID: c.Name})
if err != nil { if err != nil {
return err return err
} }
...@@ -291,9 +293,9 @@ func getContainerPid(c *Context) (int, error) { ...@@ -291,9 +293,9 @@ func getContainerPid(c *Context) (int, error) {
return 0, fmt.Errorf("Failed to find container %s", c.Id) return 0, fmt.Errorf("Failed to find container %s", c.Id)
} }
if container.State.Pid <= 0 { // if container.State.Pid <= 0 {
return 0, fmt.Errorf("Pid is %d for container %s: %+v", container.State.Pid, c.Id, container.State) // return 0, fmt.Errorf("Pid is %d for container %s: %+v", container.State.Pid, c.Id, container.State)
} // }
return container.State.Pid, nil return container.State.Pid, nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment