Harbor私服配置
- 下载harbar
https://github.com/goharbor/harbor/releases
- 解压文件到
/alidata/docker/harbor
- 复制配置文件
cp harbor.yml.tmp harbor.yml
- 编辑
harbor.yml
文件 如下配置
#配置为IP或者域名
hostname: 192.168.159.128
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 80
# https related config
# 我关闭了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
- 运行
install.sh
脚本,即可启动了harbor就可以愉快操作啦
docker私服配置 - 编辑
vim /etc/docker/daemon.json
该文件如下配置
hosts是配置打开了管理端口,便于统一管理
registry-mirrors是镜像加速仓库
insecure-registries私服地址
{
"hosts": ["tcp://0.0.0.0:2375","unix:///var/run/docker.sock"],
"registry-mirrors": ["http://hub-mirror.c.163.com"],
"insecure-registries":["192.168.159.128"]
}
编辑 /usr/lib/systemd/system/docker.service
#该行改成如下
ExecStart=/usr/bin/dockerd
#不要它后面的东西,因为会和daemon.json冲突
- 然后登陆
docker login 192.168.159.128
登陆成功 - 打包镜像文件并推送到私服
#私服的镜像打包必须是以私服的地址开头的包才行如下
docker tag maven:3-jdk-8 192.168.159.128/jx-factory/jx-app-h5:2021.05.25.01
#推送镜像到私服
docker push 192.168.159.128/jx-factory/jx-app-h5:2021.05.25.01