diff --git a/docker.go b/docker.go index 391f609..07cc514 100644 --- a/docker.go +++ b/docker.go @@ -98,19 +98,21 @@ func (lc LabeledContainer) UpdateTo(cli *client.Client, tag Tag) error { fmt.Printf("Pulling image \"%s\"\n", canonicalImage) //containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{}) - rc, err := cli.ImagePull(ctx, canonicalImage, types.ImagePullOptions{}) + imageReader, err := cli.ImagePull(ctx, canonicalImage, types.ImagePullOptions{}) if err != nil { return err } - // TODO: does it still pull the image if i just close the reader? - err = rc.Close() + defer imageReader.Close() + + loadResponse, err := cli.ImageLoad(ctx, imageReader, false) if err != nil { return err } + defer loadResponse.Body.Close() + fmt.Printf("Stopping container %s\n", lc.Container.ID) - // TODO: hopefully this is blocking err = cli.ContainerStop(ctx, lc.Container.ID, nil) if err != nil { return err diff --git a/main.go b/main.go index 7562c5c..cdcf51a 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,7 @@ func checkForUpdates() { fmt.Println(" no update available") } } - fmt.Println("all done") + fmt.Println("All done") } func main() {