How to Install and Use Harbor Private Docker Registry on CentOS (HTTP)
This guide walks you through installing Docker, Docker Compose, OpenSSL, and the Harbor private registry on CentOS, configuring Harbor, setting up insecure registries, and using Docker and Helm commands to push and pull images.
This article provides a concise step‑by‑step guide for setting up the private Docker image registry Harbor (HTTP version) on a CentOS system.
Prerequisites
Required versions:
Docker: 20.10.12
Docker‑compose: 1.29.2
Harbor: 2.4.11. Install Docker and Docker Compose
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose2. Install OpenSSL
yum install -y openssl3. Install Harbor
The official site offers online and offline installers; this guide uses the offline package.
wget https://github.com/goharbor/harbor/releases/download/v2.4.1/harbor-offline-installer-v2.4.1.tgz
tar zxvf harbor-offline-installer-v2.4.1.tgz
cd harborCopy the template configuration and edit the necessary fields: cp harbor.yml.tmpl harbor.yml Key modifications in harbor.yml (excerpt):
# Configuration file of Harbor
- hostname: reg.mydomain.com
+ hostname: your.domain.com # set your own domain
http:
port: 80
# Disable HTTPS
# https:
# port: 443
# certificate: /your/certificate/path
# private_key: /your/private_key/path
harbor_admin_password: yourPassword # set your own passwordRun the installer: ./install.sh To enable Helm Chart management, add the --with-chartmuseum flag.
4. Login and Usage
Add the Harbor hostname to /etc/hosts (e.g., 127.0.0.1 your.domain.com) and log in:
docker login -u admin -p yourPassword http://your.domain.comIf you encounter HTTPS connection errors, configure Docker to allow insecure registries:
{
"insecure-registries": ["your.domain.com:port", "0.0.0.0"]
}Restart Docker: sudo systemctl restart docker Restart Harbor if needed:
cd harbor
docker-compose down -v
docker-compose up -d5. Pushing and Pulling Images
# Docker
docker tag SOURCE_IMAGE[:TAG] your.domain.com/PROJECT_NAME/REPOSITORY[:TAG]
docker push your.domain.com/PROJECT_NAME/REPOSITORY[:TAG]
docker pull your.domain.com/PROJECT_NAME/REPOSITORY[:TAG]
# Helm
helm repo add --username admin --password ADMIN_PASSWORD harbor http://your.domain.com/chartrepo/
helm plugin install https://github.com/chartmuseum/helm-push
helm cm-push CHART_PATH --version="CHART_VERSION" harbor
helm repo update
helm search repo CHART_PATH
helm install RELEASE_NAME CHART_NAMEReplace PROJECT_NAME, CHART_PATH, CHART_VERSION, and RELEASE_NAME with your actual values.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
