If you are unable to log in to Docker, you may need to set your credentials manually.
The Docker command line tool supports authenticating sensitive operations, such as push, with the server using basic HTTP authentication.
To enforce authenticated access to docker repositories you need to provide the following parameters to the Docker configuration file.
The Docker endpoint URL (must use HTTPS for basic authentication to work)
Your Artifactory username and password (formatted
username:password
) as Base64 encoded stringsYour email address
You can use the following command to get these strings directly from Artifactory and copy/paste them into your ~/.dockercfg
file:
sudo
If you are using Docker commands with "sudo" or as a root user (for example after installing the Docker client), note that the Docker configuration file should be placed under /root/.dockercfg
Get .dockercfg entries directly from Artifactory
$ curl -uadmin:password "https://artprod.company.com/<v1|v2>/auth" { "https://artprod.company.com" : { "auth" : "YWRtaW46QVA1N05OaHZTMnM5Qk02RkR5RjNBVmF4TVFl", "email" : "admin@email.com" } }
The Docker configuration file may contain a separate authentication block for each registry that you wish to access.
Below is an example with two URL endpoints:
{ "https://artprod.company.com": { "auth":"YWRtaW46cGFzc3dvcmQ=", "email":"myemail@email.com" }, "https://artprod2.company.com": { "auth":"YWRtaW46cGFzc3dvcmQ=", "email":"myemail@email.com" } }