1. 安装Docker
如已安装 则忽略
wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz
tar xf docker-24.0.7.tgz
cd docker
cp -r * /bin/
vim /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable docker
mkdir /etc/docker
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.nju.edu.cn"],
"data-root": "/data/docker"
}
systemctl start docker
# 查看配置是否失效
docker info
2. 安装docker-compose
如已安装 则忽略
wget https://github.com/docker/compose/releases/download/v2.23.3/docker-compose-linux-x86_64
mv docker-compose-linux-x86_64 docker-compose
mv docker-compose /bin
# 验证安装
docker-compose version
3. 安装harbor
wget https://github.com/goharbor/harbor/releases/download/v2.10.0/harbor-offline-installer-v2.10.0.tgz
tar xf harbor-offline-installer-v2.10.0.tgz
cd harbor
mv harbor.yml.tmpl harbor.yml
# 配置hostname,证书,密码
vim harbor.yml
hostname: harbor.canistudy.com
certificate: /data/harbor/canistudy.com.crt
private_key: /data/harbor/canistudy.com.key
harbor_admin_password: 123456789
./prepare
./install.sh
# 浏览器访问验证安装
4. 客户端配置
# 添加如下配置
vim /etc/docker/daemon.json
{
"insecure-registries": ["harbor.canistudy.com"]
}
systemctl restart docker
5. harbor的开启和关闭
# 在安装目录下
# 关闭
docker-compose down
# 开启
docker-compose up -d
Comments NOTHING