本機地址:192.168.31.232
安裝docker-compose
1.1 下載docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.4.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
1.2 執行二進位制檔案
sudo chmod +x /usr/local/bin/docker-compose
1.3 建立軟鏈
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
1.4 測試
docker-compose version
安裝harbor
1.1 修改sysctl.conf檔案
cat > /etc/sysctl.conf <<-'EOF' net.ipv4.ip_forward=1 vm.max_map_count=655360 EOF sysctl -p systemctl stop firewalld
1.2 下載harbor
cd /usr/local wget --no-check-certificate https://github.com/goharbor/harbor/releases/download/v1.10.14/harbor-offline-installer-v1.10.14.tgz tar xzvf harbor-offline-installer-v1.10.14.tgz
1.3 修改harbor.yml檔案
注:修改hostname,改為本機地址
註釋掉https的所有配置
1.4 安裝harbor
./install
1.5 解除安裝harbor
docker-compose down
1.6 配置docker私有倉庫
cat > /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://fskvstob.mirror.aliyuncs.com"], "insecure-registries": ["192.168.31.232:80"] } EOF systemctl daemon-reload systemctl restart docker
1.7 推送自己的映象
# 推薦映象格式 Harbor IP:Port/項⽬名/映象名:Tag docker images docker tag 96e09ccfbe21 192.168.31.232:80/public/myproject:1.0 docker login -u admin -p Harbor12345 192.168.31.232:80 docker push 192.168.31.232:80/public/myproject:1.0
1.8 k8s 配置私有倉庫
vi docker-daemon.json { "registry-mirrors": ["https://dockerhub.azk8s.cn","https://hub-mirror.c.163.com"], "insecure-registries": ["192.168.31.232:80"],# 這個就是配置私有倉庫 "exec-opts": ["native.cgroupdriver=cgroupfs"], "log-driver": "json-file", "log-opts": {"max-size": "10m","max-file": "10"} }