Docker login to internal registry failed with service account as username

Solution Verified - Updated -

Issue

  • Failed to login to the internal registry when Openshift cluster is log in with service account

# oc whoami system:serviceaccount:serviceac:test # docker -D login -u $(oc whoami) -p $(oc whoami -t) docker-registry.default.svc:5000 Error response from daemon: Get https://docker-registry.default.svc:5000/v2/: unauthorized: authentication required

Environment

OpenShift Container Platform 3.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content