DEV Community

Dean
Dean

Posted on • Originally published at veducate.co.uk on

Authenticate Docker to Harbor Image Registry with a Robot Account

Just a quick blog post on how to authenticate Docker to a Harbor Image Registry, using a Robot Account, which is good for programmatically access to push/pull images from your registry.

Harbor introduced the capability for administrators to create system robot accounts you can use you run automated actions in your Harbor instances. System robot accounts allow you to use a robot account to perform maintenance or repeated task across all or a subset of projects in your Harbor instance.
Enter fullscreen mode Exit fullscreen mode

In Harbor, to create your robot account, within your project:

  • Click the Robot Accounts tab
  • Click New Robot Account
  • Enter your details as necessary and click save
  • Select export to file and save the JSON file.

Harbor - Create new robot account

Harbor - Create new robot account - fill out details

Harbor - export robot account

This file will be outputted with a “$” in the name. You can either change the name of the file, or escape the character in the terminal, which I what I’ll be doing below.

Within your terminal run the following commands:

username=$(cat **file.json** | jq -r .name)
password=$(cat **file.json** | jq -r .token)
echo "$password" | docker login **https://URL** --username "$username" --password-stdin

**Example**
username=$(cat "robot\$veducate.json" | jq -r .name)
password=$(cat robot\$veducate.json | jq -r .token)
echo "$password" | docker login https://harbor-repo.veducate.com --username "$username" --password-stdin
Enter fullscreen mode Exit fullscreen mode

docker login

Now you can pull/push images to your repository using this authentication details.

Regards

Follow @Saintdle

Dean Lewis

The post Authenticate Docker to Harbor Image Registry with a Robot Account appeared first on vEducate.co.uk.

Google AI Education track image

Build Apps with Google AI Studio 🧱

This track will guide you through Google AI Studio's new "Build apps with Gemini" feature, where you can turn a simple text prompt into a fully functional, deployed web application in minutes.

Read more →

Top comments (0)

Google AI Education track image

Build Apps with Google AI Studio 🧱

This track will guide you through Google AI Studio's new "Build apps with Gemini" feature, where you can turn a simple text prompt into a fully functional, deployed web application in minutes.

Read more →

👋 Kindness is contagious

Dive into this thoughtful piece, beloved in the supportive DEV Community. Coders of every background are invited to share and elevate our collective know-how.

A sincere "thank you" can brighten someone's day—leave your appreciation below!

On DEV, sharing knowledge smooths our journey and tightens our community bonds. Enjoyed this? A quick thank you to the author is hugely appreciated.

Okay