doulong4169 2017-06-06 22:58
浏览 169

无法通过Docker Go SDK将Docker Image推送到ECR

I'm using the docker client SDK for Go and I'm running to an issue with pushing images to my AWS ECR.

Here is the gist of my func

import (
    "github.com/docker/docker/api/types"
    dockerclient "github.com/docker/docker/client"
)
func doPush(target string) {
    envCli, err := dockerclient.NewEnvClient()
    if err != nil {
        panic(err)
    }

    rc, err := envCli.ImagePush(
        context.Background(),
        target,
        types.ImagePushOptions{})
    if err != nil {
        panic(err)
    }
    defer rc.Close()
}

My image is tagged something like [regid].dkr.ecr.us-east-1.amazonaws.com/demo:latest but I get the following error:

invalid reference format

If I remove the [:tag] from the image name, it works until I get a

Error response from daemon: Bad parameters and missing X-Registry-Auth: EOF

  • 写回答

1条回答 默认 最新

  • douhuan1905 2017-09-15 12:18
    关注

    I had the same problem, and I solved it giving an arbitrary RegistryAuth to the docker push option.

    So the following code works :

    closer, err = dockerClient.ImagePush(context.Background(), privateTagName,
                                         types.ImagePushOptions{
                        All: true,
                        RegistryAuth:"123",
                    })
    if err != nil{
      panic(err)
    }
    io.Copy(os.Stdout, closer)
    closer.Close()
    

    I read in this post that giving any value to RegistryAuth could work.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大