I have this code:
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,
})
After I run this there is no error, even if I put a on("error")
on the return of .push
.
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.
And nothing happens, no image is pushed. not sure what are those dns errors...
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"
Now the image is pushed and working.
Differences (working vs not working):
/v1.39/images/
vs/images/
- call to
/v1.39/auth
vs no call
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