How to configure Harbor registry to use Amazon S3 Storage

In this guide I will show you how to configure your Harbor registry to use S3 as the storage backend for image repositories. This will allow you to consume S3 storage instead of local storage or a docker volume for images pushed to the Harbor registry.

Pre-Reqs

  • Photon OS with at least 1 vCPU 2GB RAM and at least 5GB storage – vSphere OVA Here
  • Internet Access from Photon OS to the internet
  • A quite place where you will not get interrupted see my guide here
  • An AWS account with at least one S3 bucket created

Once you have created your S3 bucket note the name and region it is in

SSH to your Photon OS VM and login as root or a sudo account and change to the /home directory

cd /home

Next we need to install wget and tar

Type the following command and press enter

tdnf -y install wget tar

Now we need to download the Harbor install files

Note: You can find the latest release here

wget https://github.com/vmware/harbor/releases/download/v1.1.0/harbor-offline-installer-v1.1.0.tgz
tar xvf harbor-offline-installer-v1.1.0.tgz

Now change to the harbor directory and edit the harbor config file to update the host name and any other settings you choose

See full guide here

cd harbor
vi harbor.cfg

Press i to enter insert mode then update the host name then hold shift and pres zz to save the file

Now we will need to edit the following file to add our S3 storage parameters

vi common/templates/registry/config.yml

Add the following lines to the file with your bucket, regions and access key and private key

Please NOTE: You can and should delete this file after Harbor is installed as your AWS accesskey and secretkey are exposed in clear text. 

Almost there, Harbor uses Docker Compose so before continue we will need to install it with the following

 curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

Make it executable with the following command

chmod +x /usr/local/bin/docker-compose

Now install Harbor with the following command

If all went well you should see this

Open a brower to your host and view the login screen

Next up we will verify your registry is being backed by S3 storage

Remember sharing is caring!

3 Replies to “How to configure Harbor registry to use Amazon S3 Storage”

  1. Pingback: Verify your Harbor Registry is backed by S3 Storage – VMtoCloud.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.