Thanks for this library, but it's so hard to use... Like this image.push function, I can't figure out how to set it up at all... Like how to send the authToken, repositoryUrl...
I was able to use the info here to get the authconfig: https://github.com/apocas/dockerode/issues/448#issuecomment-384801924
Then the push is done as:
this.image = docker.getImage('repoUrl/your-image:latest');
const stream = await image.push({
authconfig,
tag
});
The callback and auth parameters are not required - the authconfig can be passed in as part of the options parameter.
It's important to make sure that the image.name property is prefixed with the repository url.
Although the above is true it doesn't seem to work (at least for me); here is the output I get, when trying to push the image:
[
{
status: 'The push refers to repository [docker.io/kghost0/node-test-img]'
},
{ status: 'Preparing', progressDetail: {}, id: '7171d735fb9d' },
{ status: 'Preparing', progressDetail: {}, id: '37240b679bd4' },
{ status: 'Preparing', progressDetail: {}, id: '0990c60c7f3e' },
{ status: 'Preparing', progressDetail: {}, id: '6f152cfbb108' },
{ status: 'Preparing', progressDetail: {}, id: '00d2481fffd9' },
{ status: 'Preparing', progressDetail: {}, id: '8c588d32ee1b' },
{ status: 'Preparing', progressDetail: {}, id: 'b9beeac47e56' },
{ status: 'Preparing', progressDetail: {}, id: '7b6b7b7a3f95' },
{ status: 'Preparing', progressDetail: {}, id: '8b515307dc97' },
{ status: 'Preparing', progressDetail: {}, id: '0fcbbeeeb0d7' },
{ status: 'Waiting', progressDetail: {}, id: '8c588d32ee1b' },
{ status: 'Waiting', progressDetail: {}, id: 'b9beeac47e56' },
{ status: 'Waiting', progressDetail: {}, id: '7b6b7b7a3f95' },
{ status: 'Waiting', progressDetail: {}, id: '8b515307dc97' },
{ status: 'Waiting', progressDetail: {}, id: '0fcbbeeeb0d7' },
{
errorDetail: { message: 'denied: requested access to the resource is denied' },
error: 'denied: requested access to the resource is denied'
}
]
I am sure that credentials are correct as calling docker.checkAuth returns
{"IdentityToken":"","Status":"Login Succeeded"}
Any idea?
For those who run across same problem the auth config has to be passed like that:
this.controller.pull('yourImage', { authConfig: auth }, (err, stream) => {
//
});
were auth is:
const auth = {
username: 'u1',
password: 'qwe',
serveraddress: 'https://index.docker.io/v1'
};
@ghostbuster91
Thanks a lot for the tip!
You do have a tiny typo. It should be authconfig instead of authConfig.
Most helpful comment
For those who run across same problem the auth config has to be passed like that:
were
authis: