1 回答
TA贡献1847条经验 获得超7个赞
我为我添加了工作示例:
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
func main() {
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
panic(err)
}
input := bytes.NewReader([]byte("dummy content\n"))
imageLoadResponse, err := cli.ImageLoad(context.Background(), input, true)
if err != nil {
log.Fatal(err)
}
body, err := ioutil.ReadAll(imageLoadResponse.Body)
fmt.Println(string(body))
}
//Output:
// {"errorDetail":{"message":"Error processing tar file(exit status 1): unexpected EOF"},"error":"Error processing tar file(exit status 1): unexpected EOF"}
您还可以查看docker load 命令的方式
- 1 回答
- 0 关注
- 128 浏览
添加回答
举报