From c41e32dbc161ccf73c2b9d4c2868aac2ad94644a Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Thu, 9 Feb 2017 20:39:55 -0800 Subject: [PATCH] print stderr on docker import failure --- builder/docker/driver_docker.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/docker/driver_docker.go b/builder/docker/driver_docker.go index f603b1892..a537ab2ec 100644 --- a/builder/docker/driver_docker.go +++ b/builder/docker/driver_docker.go @@ -97,9 +97,10 @@ func (d *DockerDriver) Export(id string, dst io.Writer) error { } func (d *DockerDriver) Import(path string, repo string) (string, error) { - var stdout bytes.Buffer + var stdout, stderr bytes.Buffer cmd := exec.Command("docker", "import", "-", repo) cmd.Stdout = &stdout + cmd.Stderr = &stderr stdin, err := cmd.StdinPipe() if err != nil { return "", err @@ -122,8 +123,7 @@ func (d *DockerDriver) Import(path string, repo string) (string, error) { }() if err := cmd.Wait(); err != nil { - err = fmt.Errorf("Error importing container: %s", err) - return "", err + return "", fmt.Errorf("Error importing container: %s\n\nStderr: %s", err, stderr.String()) } return strings.TrimSpace(stdout.String()), nil