环境
ubuntu 22.04
Harbor 2.13.2
root@arm1-ip-10-0-0-203:~/harbor# lscpu
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Vendor ID: ARM
Model name: Neoverse-N1
Model: 1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
Stepping: r3p1
BogoMIPS: 50.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
git clone -b v2.13.2 https://github.com/goharbor/harbor
cd harbor
修改 MakeFile
默认会拉取amd64镜像,这里使用构建方式
sed -i "s#PULL_BASE_FROM_DOCKERHUB=true#PULL_BASE_FROM_DOCKERHUB=false#g" ./Makefile
make/photon/exporter/Dockerfile
调整使用arm64架构
sed -i 's#GOARCH=amd64#GOARCH=arm64#g' make/photon/exporter/Dockerfile
构建离线安装包
root@arm1-ip-10-0-0-203:~/harbor# make package_offline VERSIONTAG=v2.13.2 PKGVERSIONTAG=v2.13.2 UIVERSIONTAG=v2.13.2
compiling and building image for exporter...
[+] Building 136.4s (15/15) FINISHED
=> [internal] load .dockerignore
=> => transferring context: 132B
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 799B
=> [internal] load metadata for docker.io/library/golang:1.24.5
=> [internal] load metadata for docker.io/goharbor/harbor-exporter-base:dev
=> CACHED [build 1/4] FROM docker.io/library/golang:1.24.5
=> [internal] load build context
=> => transferring context: 19.58MB
=> [stage-1 1/5] FROM docker.io/goharbor/harbor-exporter-base:dev
=> [build 2/4] COPY src /harbor/src
=> [build 3/4] WORKDIR /harbor/src/cmd/exporter
=> [build 4/4] RUN go build -o /out/harbor_exporter
=> [stage-1 2/5] COPY --from=build /out/harbor_exporter /harbor/harbor_exporter
=> [stage-1 3/5] COPY ./make/photon/exporter/entrypoint.sh ./make/photon/common/install_cert.sh /harbor/
=> [stage-1 4/5] RUN chown -R harbor:harbor /etc/pki/tls/certs && chown -R harbor:harbor /harbor/ && chmod u+x /harbor/entrypoint.sh && chmod u+x
=> [stage-1 5/5] WORKDIR /harbor
=> exporting to image
=> => exporting layers
=> => writing image sha256:053632cb497c91fac2a08ff3ac08dce198517522f386dda57945302f1b6ad06c
=> => naming to docker.io/goharbor/harbor-exporter:v2.13.2
Done.
make[1]: Leaving directory '/root/harbor'
packing offline package ...
saving harbor docker image
harbor/harbor.v2.13.2.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl
Done.
root@arm1-ip-10-0-0-203:~/harbor# ls -l | grep harbor
-rw-r--r-- 1 root root 542336081 Aug 21 14:42 harbor-offline-installer-v2.13.2.tgz
root@arm1-ip-10-0-0-203:~/harbor# tar xf harbor-offline-installer-v2.13.2.tgz -C /usr/local/
root@arm1-ip-10-0-0-203:~/harbor# mv harbor-offline-installer-v2.13.2.tgz /usr/local/src/
root@arm1-ip-10-0-0-203:~/harbor# cd /usr/local/harbor
root@arm1-ip-10-0-0-203:/usr/local/harbor# cp harbor.yml.tmpl harbor.yml
root@arm1-ip-10-0-0-203:/usr/local/harbor# vim harbor.yml
# 域名
hostname: harbor.sundayhk.com
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 80
# 注释,不启用https
#https:
# # https port for harbor, default is 443
# port: 443
# # The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path
# # enable strong ssl ciphers (default: false)
# # strong_ssl_ciphers: false
# 管理员密码
harbor_admin_password: Harbor12345
# 数据库密码
database:
password: root123
...
# 数据目录
data_volume: /data/harbor
root@arm1-ip-10-0-0-203:/usr/local/harbor# ./install.sh
...
[Step 5]: starting Harbor ...
[+] Running 10/10
✔ Network harbor_harbor Created 0.1s
✔ Container harbor-log Started 0.6s
✔ Container registryctl Started 1.9s
✔ Container redis Started 1.8s
✔ Container harbor-db Started 1.9s
✔ Container harbor-portal Started 2.1s
✔ Container registry Started 1.9s
✔ Container harbor-core Started 2.4s
✔ Container harbor-jobservice Started 3.1s
✔ Container nginx Started 3.2s
✔ ----Harbor has been installed and started successfully.----
访问服务器IP:80
用户名:admin 密码:Harbor12345