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 關注
- 161 瀏覽
添加回答
舉報