Container Platform

Harbor

Private container registry with scanning and RBAC

🐧 Linux🍎 Mac🪟 Windows
Reviewed: Tested on: Kubernetes 1.29 · Terraform 1.8 · Ubuntu 22.04

What is this?

Harbor is a private registry where your team stores and scans Docker images.

📥

Step 01

Install Harbor

(01)Install Harbor

Linux
1# Download Harbor offline installer from goharbor.io
2wget https://github.com/goharbor/harbor/releases/download/v2.11.0/harbor-offline-installer-v2.11.0.tgz
3tar xvf harbor-offline-installer-v2.11.0.tgz && cd harbor
4sudo ./install.sh

Step 02

Verify

(01)Verify installation

Linux
1docker ps | grep harbor
2# UI: https://localhost admin/Harbor12345

📋Config templates

1 YAML template for Harbor. Copy and deploy after setup.

1 ready-to-copy template. Expand one, copy the YAML, then run the deploy commands.

Dockerfile.python

Flask / FastAPI Python API

dockerfile
1FROM python:3.12-slim
2WORKDIR /app
3COPY requirements.txt .
4RUN pip install --no-cache-dir -r requirements.txt
5COPY . .
6EXPOSE 3000
7# Dev: CMD ["python", "main.py"]
8# Prod: CMD ["gunicorn", "-b", "0.0.0.0:3000", "main:app"]

Dockerfile.node

Node.js API with dependency caching

dockerfile
1FROM node:20-alpine AS builder
2WORKDIR /app
3COPY package*.json ./
4RUN npm ci --only=production
5
6FROM node:20-alpine
7WORKDIR /app
8COPY --from=builder /app/node_modules ./node_modules
9COPY . .
10EXPOSE 3000
11USER node
12CMD ["node", "src/index.js"]

Dockerfile.spring

Spring Boot JAR (multi-stage)

dockerfile
1FROM maven:3.9-eclipse-temurin-21 AS build
2WORKDIR /app
3COPY pom.xml .
4COPY src ./src
5RUN mvn package -DskipTests
6
7FROM eclipse-temurin:21-jre-alpine
8WORKDIR /app
9COPY --from=build /app/target/*.jar app.jar
10EXPOSE 8080
11ENTRYPOINT ["java", "-jar", "app.jar"]
📄

Step 01

Build Images

(01)Build from Dockerfile

Linux
1docker build -t myapp:1.0 -f Dockerfile.python .
2docker build -t myapi:local .
3docker images | grep myapp