Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerhub private repo authentication #654

Closed
mayacr86 opened this issue Aug 19, 2015 · 10 comments
Closed

dockerhub private repo authentication #654

mayacr86 opened this issue Aug 19, 2015 · 10 comments
Labels
docker documentation Documentation should be extended or updated

Comments

@mayacr86
Copy link

Is there a way to set the authentication for a private repository on dockerhub?

dockerRepository := Some("myRepo")

dockerRepositoryAuth := Some("myAuthToken") ???

If not, what would be a work around? I want to automate the process of docker:publish with TeamCity.

@muuki88
Copy link
Contributor

muuki88 commented Aug 20, 2015

I'm afraid you have to configure your docker daemon. This is from our gitter chat:

Because there didn’t seem to be a way to inject auth information without altering the environment, the plugin punts on the issue, and requires you to have run docker login as the build user, for any repositories requiring authentication.
Your local repository won’t need any authentication anyway (at least, I’ve never seen it), so it doesn’t matter until you run sbt docker:publish

and

It just assumes thedocker command works. It’s a thin wrapper around docker build and docker push, so you can always run those commands manually.

cc @fiadliel

@fiadliel
Copy link
Contributor

Yes, the problem was that you can't provide authentication on a once-off basis for pushing, without it being added to ~/.docker/config.json. A permanent change to the environment is not what somebody might expect (and could even be a security issue), so this feature was left out.

You can manually run the command to log into a Docker server, if you have the ability to run particular commands in the environment:

$ docker login -h

Usage: docker login [OPTIONS] [SERVER]

Register or log in to a Docker registry server, if no server is
specified "https://index.docker.io/v1/" is the default.

  -e, --email=       Email
  --help=false       Print usage
  -p, --password=    Password
  -u, --username=    Username

@mayacr86
Copy link
Author

Thanks for the quick response :)

Well, it does make sense that a plugin shouldn't change to the environment... I was just hoping for an easier way to do it :p

Right now, I'm using the following command as one of the Build Steps on my TeamCity deployment process:

$ docker login -e [userEmail] -p [userPass] -u [userName]

After that step, I do the docker:publish and it does the trick!

Thanks anyway!

@muuki88 muuki88 added documentation Documentation should be extended or updated and removed feature request labels Aug 20, 2015
@muuki88
Copy link
Contributor

muuki88 commented Aug 20, 2015

There is small section in the documentation.

I leave this issue open to extend the docs there.

@nhooey
Copy link

nhooey commented May 8, 2018

It would be nice if the word "password" was near the text:

It is currently not possible to provide authentication for Docker repositories from within the build.

So when someone is searching the page, they can find it.

@muuki88
Copy link
Contributor

muuki88 commented May 8, 2018

Sounds reasonable. Would you like to open a pull request 😎?

@mkurz
Copy link
Member

mkurz commented Oct 15, 2019

It would be nice if the word "password" was near the text

Would have saved me some time as well...

@muuki88
Copy link
Contributor

muuki88 commented Oct 24, 2019

@mkurz would you like to add a small section in the docs?

@mkurz
Copy link
Member

mkurz commented Nov 2, 2019

@mkurz would you like to add a small section in the docs?

@muuki88 Done, see #1275

@muuki88
Copy link
Contributor

muuki88 commented Nov 5, 2019

Awesome ❤️

@muuki88 muuki88 closed this as completed Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker documentation Documentation should be extended or updated
Projects
None yet
Development

No branches or pull requests

5 participants