user_mda
user_mda

Reputation: 19418

Saving docker credentials in docker config

I have a private hosted registry at www.myDockerRepo.company.com:2222. To login to this repository I follow these steps

docker login www.myDockerRepo.company.com:2222
username : xxx
password : ***
email : [email protected]

WARNING: login credentials saved in /home/vagrant/.docker/config.json
Login Succeeded

Can these credentials be saved before hand in the config.json so that clients dont need to manually enter these credentials n every login? What is the best practice to login to private registries?

Upvotes: 1

Views: 4264

Answers (1)

Ken Cochrane
Ken Cochrane

Reputation: 77375

Yes, you can manually add the creds to the config. Just copy the file over from a host that you already logged in with.

As far as best practices, they depend on the setup, but most common is to use a generic system account for your registry that is only used by the hosts, and then when setting up the hosts and installing docker, drop in the config file for that system user. Then all pushes and pulls from those servers will be with that account.

If you try and reuse a user account, things will break if that user changes their password. It also allows you to have different permissions for hosts, maybe pull only access vs push, etc.

Upvotes: 1

Related Questions