In this article we are going to cover,Upgrade Ubuntu OS from 16.04 LTS to 20.04 LTS,Upgrade Harbor from v1.10.7 to v2.4.0 then 2.6.0 and Migrate Harbor data,Rollback Harbor from v2.6 to v1.10.7.
If you are facing issue while docker push, log are not capturing on Harbor UI with old Harbor Versions then you have to upgrade your OS and Upgrade Harbor version to Harbor latest version.
Prerequisites:
- Ubuntu Server with 20.04/18.04/16.04 LTS
- 4 CPU and 8 GB RAM
- Preinstalled Docker, Docker-compose, PostgreSQL
- Take backup of exiting Harbor data and /data/database directory.
Note: Back up Harbor’s current files so that you can roll back to the current version if necessary, Below are steps
mv harbor /my_backup_dir/harbor
Back up the database, which by default is in the directory /data/database.
cp -r /data/database /my_backup_dir/
Table of Contents
Step #1: Upgrade Ubuntu OS from 16.04 LTS to 18.04 LTS then to 20.04 LTS
Below are steps to upgrade Ubuntu OS from 16.04 to 18.04 then to 20.04
sudo apt update && sudo apt upgrade
sudo apt --fix-broken install
sudo apt install update-manager-core
sudo apt-get install aptitude -y
sudo aptitude safe-upgrade
sudo do-release-upgrade -c
sudo do-release-upgrade
sudo reboot
cat /etc/lsb-release
Step #2:Upgrade Harbor and Migrating Data from Version v1.10.7 to Version v2.4
Log in to the Harbor host and, check docker-compose service of Harbor , if it is still running, stop the existing Harbor instance using below command
docker-compose down
Get the latest Harbor release package from go Harbor official GitHub page
Before upgrading Harbor, We need Docker Image for migration.
The migration tool is delivered as a docker image. You can pull the image from the docker hub. Replace [tag] with the new Harbor version, for example, v1.10.0, in the following command:
Syntax:
docker pull goharbor/harbor-migrator:[tag]
Example:
docker pull goharbor/harbor-migrator:v1.10.8-dev
Alternatively, if you are using an offline installer package, you can load it from the image tarball that is included in the offline installer package. Replace [tag] with the new Harbor version, for example, v1.10.0, in the following command:
Syntax:
tar zxf <offline package>
Example:
tar zxf harbor-offline-installer-v2.4.0.tgz
Syntax:
docker image load -i harbor/harbor.[version].tar.gz
Example:
docker image load -i harbor/harbor.v2.4.0.tar.gz
Upgrade the harbor.yml
file.
Syntax:
docker run -it --rm -v ${harbor_yml}:/harbor-migration/harbor-cfg/harbor.yml goharbor/harbor-migrator:[tag] --cfg up
Example:
docker run -it --rm -v ${harbor.yml}:/harbor-migration/harbor-cfg/harbor.yml goharbor/harbor-migrator:v1.10.8-dev --cfg up
NOTE: The schema upgrade and data migration of the database is performed by the core when Harbor starts. If the migration fails, check the core log to debug.
In the ./harbor
directory, run the ./install.sh
script to install the new Harbor instance.

Step #3:Upgrade Harbor and Migrate data from Version v2.4 to Version v2.6
We are repeating the above 3 steps
Syntax:
tar zxf <offline package>
Example:
tar zxf harbor-offline-installer-v2.4.0.tgz
Syntax:
docker image load -i harbor/harbor.[version].tar.gz
Example:
docker image load -i harbor/harbor.v2.4.0.tar.gz
Upgrade the harbor.yml
file.
Syntax:
docker run -it --rm -v ${harbor_yml}:/harbor-migration/harbor-cfg/harbor.yml goharbor/harbor-migrator:[tag] --cfg up
Example:
docker run -it --rm -v ${harbor.yml}:/harbor-migration/harbor-cfg/harbor.yml goharbor/harbor-migrator:v1.10.8-dev --cfg up
Run the ./install.sh
script under the /harbor directory to install the new Harbor instance.

Rollback Harbor from v2.6 to v1.10.7
Stop and remove the current Harbor service if it is still running.
cd harbor
docker-compose down
Remove current Harbor instance ( /harbor directory)
rm -rf harbor
Restore the older version of Harbor from v2.6 to v1.10.7.
mv /my_backup_dir/harbor harbor
To restore the database, copy the data files from the backup directory to your data volume, which by default is /data/database.
cp -r /my_backup_dir/data/database /data/database
Restart the Harbor service using the previous configuration.
If the previous version of Harbor was installed by a release build:
cd harbor
./install.sh
Conclusion:
We have covered Upgrade Ubuntu OS from 16.04 LTS to 18.04 LTS then to 20.04 LTS, Upgrade Harbor and Migrating Data from Version v1.10.7 to Version v2.4 and Upgrading Harbor and Migrate data from Version v2.4 to Version v2.6, Rollback Harbor from v2.6 to v1.10.7
Related Articles:
19 Dockerfile Instructions with Examples | Complete Guide
Reference:
Great!! Congratulations!!!!
Thanks.
will be good write to do it in k8s