线上安装包 https://download.docker.com/linux/static/stable/x86_64/
有公网时下载对应版本:
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz2)解压
tar -xvzf docker-20.10.0.tgz3)复制内容到对应目录
cp docker/* /usr/bin/4)编写docker.service
vi /etc/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 # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process # restart the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target
授权
chmod +x /etc/systemd/system/docker.service5)启动
systemctl start docker.service6)查看状态
systemctl status docker.service7) 开机自启动
systemctl enable docker.service二、安装docker-compose 1)下载
官网:https://github.com/docker/compose/releases
本次测试版本
链接: https://pan.baidu.com/s/1PwSxF9DWhjXbDaKO1bQ1DA 提取码: 128u
cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose3)检测是否安装成功
docker-compose --version三、安装harbor 1)下载
官网:https://github.com/goharbor/harbor/releases
链接: https://pan.baidu.com/s/1PrlDRVFHygxO0OOrw43CUQ 提取码: 49m1
tar -xzvf harbor-offline-installer-v2.3.4.tgz3)修改配置文件
如果是harbor.yml.tmpl,则复制
cp harbor.yml.tmpl harbor.yml
修改文件,不需要https访问
vi harbor.yml
hostname: ip地址,公网ip http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 8051 # https related config #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/path4)启动
.prepare
./install.sh5)登录网址
hostname:port
hostname和port 是配置文件里面配置的ip和端口
用户名:admin
密码:Harbor12345
用户名和密码配置文件里面也有
需要修改daemon.json文件
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://i22aew6l.mirror.aliyuncs.com"],
"insecure-registries": ["hostname:8051"]
}
hostname是harbor.yml配置文件里面的hostname
docker login hostname:port Username: admin Password: Harbor123457)推送镜像到harbor
打标签
docker tag test:v1 hostname:port/harbor项目名/test:v2 docker push hostname:port/harbor项目名/test:v2



