Search code examples
dockercontainersdocker-registry

docker login with non interactive session returns 401


I have a really strange issue with the non interactive docker login command. I am trying to login to my docker repository using the following command:

docker login -u emi -p 123 my.dockerrepo.com:5000

This command returns the following error:

Error response from daemon: login attempt to https://my.dockerrepo.com:5000/v2/ failed with status: 401 Unauthorized

However, if I run the above command without -p and enter the same password in the shell it works perfectly.


Solution

  • Consider using a single quotations. According to the spec it should work but I ran in to the same problem before with docker version 17.03.0-ce docker login -u 'emi' -p '123' my.dockerrepo.com:5000 would work in your case.