I was created a private repository at https://hub.docker.com and docker login working fine. I am trying to make it via saltstack and login using this link.
salt '*' docker.login <url> <username> <password> <email>
salt '*' docker.login 'https://registry.hub.docker.com/v1/' 'username' 'password' 'XxXX.xxxx@xxxx.XXX'
I was getting this error
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/minion.py", line 797, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/modules/dockerio.py", line 1167, in login
return client.login(url, username, password, email)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 615, in login
return self._result(response, json=True)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 86, in _result
self._raise_for_status(response)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 82, in _raise_for_status
raise errors.APIError(e, response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("</html>")
I think the repository url was wrong. The URL must end with /v1/ as per the issue What is "registry url to authenticate to" for my repository?
It was working with this format. (Without any URL).
salt '*' cmd.run "docker login -u username -p password -e email@xxxxx.xxx"
(or)
salt '*' docker.login 'username' 'password' 'email@xxxxx.xxx'