Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Support sending registry auth #9

Closed
byrnedo opened this issue Aug 4, 2017 · 9 comments
Closed

Support sending registry auth #9

byrnedo opened this issue Aug 4, 2017 · 9 comments
Assignees

Comments

@byrnedo
Copy link

byrnedo commented Aug 4, 2017

I run cron in a container. The cron would run Jaas. In order for the jaas service to pull a private image we'd need to send the registry login via jaas.

Expected Behavior

Accepts registry auth as cli option and allows use of private images

Current Behavior

Can't use private image if run via docker

@alexellis
Copy link
Owner

alexellis commented Aug 4, 2017

Thanks for taking an interest in my JaaS project, you might also like Functions as a Service which is much more complete for running ad-hoc functions on Docker Swarm.

So regarding JaaS - since you can't login interactively through cron, you would need to provide the encoded registry token to the CLI. Here's an example for a new flag I can add -registryAuth:

$ echo admin:admin | base64
YWRtaW46YWRtaW4K
$ jaas -registryAuth=YWRtaW46YWRtaW4K -etc -etc

Does that work for you?

@alexellis alexellis self-assigned this Aug 4, 2017
@byrnedo
Copy link
Author

byrnedo commented Aug 4, 2017

Your Faas project looks really interesting, I'll have to set aside some time to read through the setup!

That sounds good if it's that simple. I had a look at the docker client, I guess it's maybe a customer header when you make the client?

@alexellis
Copy link
Owner

So do you have a password protecting pulls or just push? Is this registry:2 or the Docker Hub you mean by "private"?

@byrnedo
Copy link
Author

byrnedo commented Aug 4, 2017

registry:2 self-hosted, protecting both.

@alexellis
Copy link
Owner

alexellis commented Aug 4, 2017

It'll be something more like this then via docs:

$ jaas -image=myregistrydomain.com:5000/pinger -rm -showlogs=true --registryAuth=$(echo '{"username": "admin", "password": "admin"}'|base64)

You may just want to store the result of $(echo '{"username": "admin", "password": "admin"}'|base64 into a file.

Try pulling from master and re-building.

@byrnedo
Copy link
Author

byrnedo commented Aug 4, 2017 via email

@byrnedo
Copy link
Author

byrnedo commented Aug 4, 2017

Actually, I think it's just a header with user:pass, basic auth. My local .docker/config.json has the following for instance:

{
	"auths": {
		"https://index.docker.io/v1/": {
			"auth": "DUMMYBASE64="
		},
		"registry.acme.se": {
			"auth": "DUMMYBASE64="
		}
	}
}

Where registry.acme.se is v2.

EDIT: Ah ok, I see that one can actually login with v2 api: https://success.docker.com/Cloud/Solve/How_do_I_authenticate_with_the_V2_API%3F

@alexellis
Copy link
Owner

alexellis commented Aug 4, 2017

There is the additional flag in the CLI now -registryAuth=. If you want to parse your file with jq and pass it to the CLI that's fine, it would also work. MacOS doesn't use this file anymore but the keychain.

Let me know how you get on with the fix. I'll close the issue for now since there is a way to do this.

@byrnedo
Copy link
Author

byrnedo commented Aug 7, 2017

Thanks very much, @alexellis!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants