func importImage(client *dockerClient.Client, name, fileName string) error { file, err := os.Open(fileName) if err != nil { return err } defer file.Close() log.Debugf("Importing image for %s", fileName) repo, tag := dockerClient.ParseRepositoryTag(name) return client.ImportImage(dockerClient.ImportImageOptions{ Source: "-", Repository: repo, Tag: tag, InputStream: file, }) }