Golang Docker SDK : Pushing large image into remote registry failing

193 Views Asked by At

Im having hard time understanding how image push works

var authConfig = types.AuthConfig{
    Username:      "amokkara",
    Password:      "dummy",
    ServerAddress: "https://docker.repo.dummy.dummy.com",
}

ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
defer cancel()

authConfigBytes, _ := json.Marshal(authConfig)
authConfigEncoded := base64.URLEncoding.EncodeToString(authConfigBytes)
opts := types.ImagePushOptions{RegistryAuth: authConfigEncoded}
ioreader , err := dockerClient.ImagePush(ctx,"docker.repo.dummy.dummy.com/amokkara/ads-nodeinfo- 
    controller:test",opts)
if err != nil {
    return err
}
    defer ioreader.close()
io.Copy(os.Stdout, ioreader)

return nil 

Im trying to push large image to remote registry (~500 mb) How to know when image is pushed? And in my case, im getting "file already closed" error on ioreader and cant find image pushed into repo.

How to make this work?

NOTE: for smaller images, im not getting "file already closed" error, but not sure how to know if the image has been pushed or not.

0

There are 0 best solutions below