Reputation: 1133
Tired of typing in login and password. So the registry is the same, but accounts are different. Should I just make a script that replaces ~/.docker/config.json?
Upvotes: 1
Views: 1847
Reputation: 51876
Unfortunately, no. The config.json
can only hold one credentials value for each remote registry. Moreover, there is an open issue to handle multiple logins to dockerhub.
However, you can easily solve the problem using bash aliases. Edit your ~/.bashrc
file and add the following lines:
alias dl1='docker login -u <user1> -p <password1>'
alias dl2='docker login -u <user2> -p <password2>'
Now you can do dl1
to login to account1 and dl2
to switch to account2
You can basically also do something similar if you are on MAC or Windows.
Upvotes: 3