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

Problem with private registry on 17.06 #6

Closed
danieljuhl opened this issue Jul 30, 2017 · 8 comments · Fixed by #10
Closed

Problem with private registry on 17.06 #6

danieljuhl opened this issue Jul 30, 2017 · 8 comments · Fixed by #10

Comments

@danieljuhl
Copy link

After upgrading docker to 17.06, shepherd no longer works, as updating a service requires the flag --with-registry-auth to be passed manually on each service update if the service was created with this flag.

I tried making a fork, and apply this flag for all service updates if engine is higher than 17.05, but though the command executed works if I'm connected directly to the docker node, it doesn't work as expected when executed by shepherd.

Could it be some missing permissions for the shepherd service?

@caoer
Copy link

caoer commented Jul 30, 2017

probably need to pass the credential about the private registry info into docker environment.

I tried running ./shepherd on the host machine, the updates works.

@danieljuhl
Copy link
Author

@caoer you are probably right.. how to pass/expose the credentials to shepherd? And how to ensure that shepherd has access to the credentials used during service create? Let's say I create a shepherd service, and then add new services to the swarm. I would then manually have to re-create the shepherd service, or?

@caoer
Copy link

caoer commented Aug 5, 2017

to pass credential, use docker's environment virable, and then passed into the shepherd script.
I dont' think it needs manually re-create the service, if manually...this script just makes no sense.

checkout the script, It runs docker command docker service inspect to find out which service needs to run update command. If in the swarm environment, I believe it will be fine if it runs on manager node.

I'm just too lazy/busy...so I'm fine with running outside of docker for it...But It is a wonderful idea, and PRs are always welcome!

@djmaze
Copy link
Collaborator

djmaze commented Aug 10, 2017

Just had a quick look this. Yes, the credentials have to be passed somehow. Unfortunately I won't have time to look at this until the week after next. In the meantime, as @caoer said, PR's are welcome ;)

@danieljuhl
Copy link
Author

@djmaze I'm more than happy to help - but to be honest.. I have no idea where to start :)

I think for it to really work, the credentials has to be "exposed" from the host. If you'd have to pass the credentials manually to the shepherd service, you would also have to know in advance which services in running and will be running in the swarm.

So ideally, shepherd should (if possible) use the credentials from the host, as Docker already make sure, that all manager nodes is having access to the registry auth, and has the possibility to pass these credentials to the worker nodes.

@danieljuhl
Copy link
Author

For your reference, I have already opened an issue in moby/moby#33929

@tbenton
Copy link

tbenton commented Nov 30, 2017

To work around the problem, we are using secrets to pass the credentials for our registry. Added a docker login inside the shepherd script. Our private repository images now update correctly.

@danieljuhl Thank you for outlining a solution.

@ledermann
Copy link
Contributor

I stumbled upon the same issue and found the following solution:

docker service create --name shepherd \
--constraint "node.role==manager" \
--env SLEEP_TIME="1m" \
--env BLACKLIST_SERVICES="shepherd" \
--env WITH_REGISTRY_AUTH="true" \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,ro \
--mount type=bind,source=/root/.docker/config.json,target=/root/.docker/config.json,ro \
ledermann/shepherd

This works fine for me (with an image build by myself). Will add a PR about this soon.

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

Successfully merging a pull request may close this issue.

5 participants