2

I'm always getting:

Error response from daemon: Get "https://myregistry.example.com/v2/": unauthorized: authentication required

When trying to login with:

docker login --username robot$myproject+myrobotaccount myregistry.example.com
Reto Höhener
  • 5,419
  • 4
  • 39
  • 79

2 Answers2

4

Quote the robot username on Linux:

docker login --username 'robot$myproject+myrobotaccount' myregistry.example.com

But, do NOT quote the username on Windows

docker login --username robot$myproject+myrobotaccount myregistry.example.com
Reto Höhener
  • 5,419
  • 4
  • 39
  • 79
  • With newer Harbor versions >2.2 I advise replacing the prefix containing the $ with something else like @ or _ to avoid all possible problem with scripting and CI/CD where the $ (dollar sign) has a special meaning. – Vad1mo Jan 04 '22 at 12:52
0

don`n forget about special character - $

export DOCKER_USERNAME=robot\$myproject+myrobotaccount
export DOCKER_PASSWORD=sdfsdfsdfsdfsdfsdfsdfsdfsdfW
export CI_REGISTRY=myregistry.example.com

echo "$DOCKER_PASSWORD" | docker login "$CI_REGISTRY" --username $DOCKER_USERNAME --password-stdin
Nikolay Baranenko
  • 1,582
  • 6
  • 35
  • 60