Docker Community Forums

Share and learn in the Docker community.

Automating the pull from a private repository


(Isaacpm) #1

Hi,

I’m trying to automate the pull of containers at build time from a private repo, so it needs authentication.
What would be the best way to put the authentication in the build script, I’m not keen on writing my username/password there.

Thanks,
Isaac


(Nathan Le Claire) #2

Take a look at this: https://docs.docker.com/registry/spec/auth/token/

There are some fairly recent new methods which can be used to authenticate with registries IIRC


(Isaacpm) #3

thanks! that seems to be what I was looking for :slight_smile:


(Isaacpm) #4

Do you have a bit more info on how to use the token once it’s created?
I think I got it created correctly, now I’m trying to use it by adding the following to the docker config:
“HttpHeaders”: {
“X-Registry-Auth”: “token-string”
}

But it’s hard to know if the token is wrong or the config file is wrong. As I don’t get any auth error.
I’m getting an image not found error, same as when I’m logged out.

Thanks,
Isaac