sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
sudo yum makecache fast
sudo yum -y install docker-ce
sudo service docker start
systemctl enable docker
docker version
cat >> /etc/docker/daemon.json <<-EOF
{
"registry-mirrors": [
"http://74f21445.m.daocloud.io",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
],
"insecure-registries": ["node01"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
9.重启docker服务
systemctl restart docker
docker info
1.下载安装。
mkdir -p /data/softs
cd /data/softs
wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.2/cri-dockerd-0.3.2.amd64.tgz
tar xf cri-dockerd-0.3.2.amd64.tgz
mv cri-dockerd/cri-dockerd /usr/local/bin/
cri-dockerd --version
cat > /etc/systemd/system/cri-docker.service <<-EOF
[Unit]
Description=CRI Interface for Docker Application Container Engine
Documentation=https://docs.mirantis.com
After=network-online.target firewalld.service docker.service
Wants=network-online.target
Requires=cri-docker.socket
[Service]
Type=notify
ExecStart=/usr/local/bin/cri-dockerd --container-runtime-endpoint fd://
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/cri-docker.socket <<-EOF
[Unit]
Description=CRI Docker Socket for the API
PartOf=cri-docker.service
[Socket]
ListenStream=%t/cri-dockerd.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target
EOF
sudo systemctl daemon-reload
sudo systemctl start cri-docker
sudo systemctl status cri-docker
yum -y insta11 docker-compose
mkdir /data/{softs,server} -p && cd /data/softs
wget https://ghproxy.com/https://github.com/goharbor/harbor/releases/download/v2.5.0/harbor-offline-installer-v2.5.0.tgz
tar -zxvf harbor-offline-installer-v2.5.0.tgz
mv harbor /data/server/harbor
cd /data/server/harbor/
docker load < harbor.v2.5.0.tar.gz
docker images
cp harbor.yml.tmpl harbor.yml
vim harbor.yml
1. 更换名称
2. 禁用http的服务
3. 更改密码
4. 设置数据路径。
./prepare
./install.sh
docker-compose ps
docker-compose down
vim /etc/systemd/system/harbor.service
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
[Service]
Type=simp1e
Restart=on-failure
RestartSec=5
#需要注意harbor的安装位置
ExecStart=/usr/bin/docker-compose --file /data/server/harbor/docker-compose.yml up
ExecStop=/usr/bin/docker-compose --file /data/server/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target
加载服务配置文件
systemctl daemon-reload
启动服务
systemctl start harbor
检查状态
systemctl status harbor
设置开机自启动
systemctl enable harbor
docker-compose ps
docker tag aaa node01/zzy/aaa:v01
第二步:登录harbor。
第三步:提交镜像。
docker push harbor地址/仓库名称/服务器名称:对应版本号
案例:所有节点都需要进行下面的验证。
https://blog.csdn.net/qq_47354826/article/details/115465461
在node03
docker pull nginx
docker pull tomcat
docker images
打标签
docker history nginx:latest
docker tag nginx:latest node01/zzy/nginx:1.25.2
docker images
docker login node01
docker push node01/zzy/nginx:1.25.2