如何使用dockerode推送图像? (未推送图片,但没有错误) [英] How to push image with dockerode? (image not pushed but no error)

查看:70
本文介绍了如何使用dockerode推送图像? (未推送图片,但没有错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码:

import * as Docker from 'dockerode'
const docker = new Docker()
const remoteDockerImage = docker.getImage(`${awsRepoUrl}:${version}`)

await remoteDockerImage.push({
  authconfig: { base64: 'auth token from aws' },
  tag: version,
})

我之后运行此命令没有错误,即使我在 .push 的返回值上放置了 on( error)

After I run this there is no error, even if I put a on("error") on the return of .push.

这会在docker日志中创建以下内容

And this creates the following in docker logs

[18:47:06.056][ApiProxy       ][Info   ] time="2019-01-18T18:47:06+08:00" msg="proxy >> POST /images/284135xxxxxx.dkr.ecr.us-east-1.amazonaws.com/xxxx:v0.1.200/push?tag=v0.1.200\n"
[18:49:18.018][DnsUpdater     ][Error  ] Unable to update dns settings: Value cannot be null.
Parameter name: first
[18:49:18.018][DnsUpdater     ][Info   ] Network configuration change detected
[18:49:19.068][DnsUpdater     ][Error  ] Unable to update dns settings: Value cannot be null.

什么也没有发生,没有图像被推送。不知道是什么dns错误...

And nothing happens, no image is pushed. not sure what are those dns errors...

但是现在当我进入CMD行并运行 docker login -u AWS -p secretAWSkey https://284135xxxxxx.dkr.ecr.us-east-1.amazonaws.com ,然后 docker push my-image 日志:

But now when I go to the CMD line and I run docker login -u AWS -p secretAWSkey https://284135xxxxxx.dkr.ecr.us-east-1.amazonaws.com and then docker push my-image I see in the logs:

[18:57:17.517][ApiProxy       ][Info   ] time="2019-01-18T18:57:17+08:00" msg="proxy << POST /v1.39/auth (5.1241041s)\n"
[18:57:17.694][ApiProxy       ][Info   ] time="2019-01-18T18:57:17+08:00" msg="proxy >> GET /_ping\n"
[18:57:17.699][ApiProxy       ][Info   ] time="2019-01-18T18:57:17+08:00" msg="proxy << GET /_ping (3.9935ms)\n"
[18:57:18.107][ApiProxy       ][Info   ] time="2019-01-18T18:57:18+08:00" msg="proxy >> POST /v1.39/images/284135xxxxxx.dkr.ecr.us-east-1.amazonaws.com/app-repo/push?tag=v0.1.206\n"

现在图像是

差异(工作与不工作):

Differences (working vs not working):


  • /v1.39/images / / images /

  • 调用 /v1.39/auth 与不调用

  • /v1.39/images/ vs /images/
  • call to /v1.39/auth vs no call

不知道该怎么办,因为dockerode的api确实很糟糕或丢失了,我不知道该怎么做。任何帮助表示赞赏。谢谢

Not sure what to do, as the api for dockerode is really bad or missing and I can't figure out how to do it. Any help is appreciated. thank you

推荐答案

根据 dockerode README.md 文件,则可能需要交换 base64对于钥匙在 authconfig 对象中。

As per dockerode's README.md file, you might need to swap "base64" for "key" in the authconfig object.

请在此处查看 pull 示例: https://github.com/apocas/ dockerode / blob / master / README.md#pull-from-private-repos

Please look a the pull example here : https://github.com/apocas/dockerode/blob/master/README.md#pull-from-private-repos

这篇关于如何使用dockerode推送图像? (未推送图片,但没有错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆