Saturday, August 20, 2016

Multiple logins for Docker Hub


Features like teams and groups for DockerHub have been slow to get added and even slower for DockerCloud. This means multiple hub accounts - one for you as a developer and one for managing the repos of your workplace.

And you may often end up wondering:
How to use `docker login` to register multiple usernames so if one doesn't work for the repo you're trying to upload, it uses another one?
The answer is that its currently not possible!

If you look inside the config file (`cat ~/.docker/config.json`)
You will realize that `index.docker.io` corresponds to the key for your login to dockerhub and there isn't a clever way in the framework right now for it to distiguish between multiple usernames. That is to say the value of that key is not an array but just an object. In the future if we can get something like:
... notice the additional [] symbols indicating an array ... then there may be a possibility for such a feature.

There are references to alternative credential stores in the docs but it is not clear if such docker-credential-helpers understand multiple logins for the same site or not. Perhaps is would be best to setup teams and groups properly with permissions rather than focusing energy into managing multiple logins.