dockerode icon indicating copy to clipboard operation
dockerode copied to clipboard

buildImage from image in private registry

Open ACosaLinan opened this issue 4 years ago • 2 comments

Hi! I can not build an image from an image in a private registry. Here is an example of my code:

Dockerfile: FROM <any_image_in_private_registry>

index.js

var Dockerode = require('dockerode');
dockerClient = new Dockerode();

dockerClient.buildImage({
      context: __dirname,
      src: ['Dockerfile']
}, {
      t: 'imgcwd',          
      registryconfig: {
            username:"[email protected]",
            password:"xxxxxx", 
            auth:"",
            serveraddress:"privateregistry.xxxx.com:8443",
            email: '',
      }
}, function(error, output) {
      if (error) {
            return console.error(error);
      }
      output.pipe(process.stdout);
});

I get the response of ... "denied .Access forbidden".

It works with public images. Do you have any idea? Thanks!

ACosaLinan avatar Apr 26 '21 14:04 ACosaLinan

Having same issue @ACosaLinan. Were you able to figure out a workaround?

I'm using authconfig instead of registryconfig though.

markcellus avatar Jun 11 '21 21:06 markcellus

It looks like the docker engine /build endpoint does not support the X-Auth-Config header, but requires a X-Registry-Config header. Meaning the authconfig option does not have any effect for the buildImage method.

The registryconfig option does work with the following format, which is compatible with authentication to multiple registries (something desirable for a build).

registryconfig: {'https://index.docker.io/v1/': {username: 'myusername', password: '<mypass>'}}

pipex avatar Mar 08 '22 22:03 pipex

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Open a new issue if needed.

stale[bot] avatar Sep 11 '23 08:09 stale[bot]