博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
docker harbor镜像仓库
阅读量:4357 次
发布时间:2019-06-07

本文共 2348 字,大约阅读时间需要 7 分钟。

docker harbor安装使用:

https://github.com/goharbor/harbor/releases

 

有离线安装和在线安装两种方式

安装:

1、下载安装包

https://github.com/goharbor/harbor/releases

在线安装包,体积小:

wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-online-installer-v1.8.1.tgz

离线安装包,体积大:

wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.1.tgz

2、修改配置文件

tar -xvf harbor-online-installer-v1.8.1.tgz

cd harbor/

vim harbor.yml

hostname: 118.xxx.xxx.xxx    #主机名,可以是域名和IP

port: 80    #访问端口,做了ssl域名正式可以设置成443

harbor_admin_password: Harbor12345   #harbor页面等登录密码

database:

  password: root123    #数据库密码

data_volume: /data  #数据卷的路径,是本机的真实路径

 

3、下载docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

4、执行安装脚本

./install.sh

5、登录harbor界面

用户名:admin

密码:Harbor12345

 

6、启动和停止harbor

cd harbor#启动和停止harbor需要找docker-compose.yml文件,所以必须进入harbor安装目或者-f指定harbor项目的docker-compose.yml

docker-compose start/stop

7、推送镜像

docker tag SOURCE_IMAGE[:TAG] 118.xxx.xxx.xxx/myproject/IMAGE[:TAG] #打标签

docker push 118.xxx.xxx.xxx/myproject/IMAGE[:TAG] #推送

推送执行时报错:

1) The push refers to repository 118.xxx.xxx.xxx/myproject/nginx]

Get https://118.xxx.xxx.xxx/v2/: dial tcp 118.xxx.xxx.xxx:443: connect: connection refused

这是因为默认情况下访问的是443端口,需要证书认证,我们没有,需要在配置文件中添加仓库安全地址

[root@VM_0_3_centos harbor]# cat /etc/docker/daemon.json

{"registry-mirrors": ["http://f1361db2.m.daocloud.io"],

"insecure-registries": ["118.xxx.xxx.xxx"]

}

2) The push refers to repository [118.xxx.xxx.xxx/myproject/nginx]

d7acf794921f: Preparing

d9569ca04881: Preparing

cf5b3c6798f7: Preparing

denied: requested access to the resource is denied

因为我们创建的项目是私有项目,需要登录之后才能上传镜像

[root@VM_0_3_centos ~]# docker login 118.xxx.xxx.xxx

Username: admin

Password:#如果没有改动过,admin密码是Harbor12345,也可以在harbor上为项目创建一个用户

3) docker login发生错误

Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

需要给docker添加dns配置

[root@VM_0_3_centos harbor]# cat /etc/docker/daemon.json

{"registry-mirrors": ["http://f1361db2.m.daocloud.io"],

"insecure-registries": ["118.xxx.xxx.xxx"],

"dns":["8.8.8.8","114.114.114.114"]

}

 

转载于:https://www.cnblogs.com/Christine-ting/p/11090973.html

你可能感兴趣的文章
linux配置scp交互传输,Linux间传输文件的几种方法scp、sftp
查看>>
linux安装nginx映射目录,centos8自定义目录安装nginx(教程详解)
查看>>
linux cpu scheduler,A Temporal Partition-Based Linux CPU Scheduler
查看>>
c语言怎么写最小公倍数的函数,C语言 · 最小公倍数
查看>>
c语言中的头文件string.h的作用,C语言常用头文件及库函数——string.h
查看>>
c语言字符-1代表什么,玩儿转C语言:符号和字符(1)
查看>>
知道商洛学院c语言章节答案,C语言程序设计(商洛学院)知到章节答案
查看>>
c语言酒精检测仪程序代码,单片机酒精浓度测试仪,代码,原理图
查看>>
单路电压表c语言编程,单片机数字电压表的设计
查看>>
精通c语言的标准,《精通Unix下C语言编程与项目实践》之七——标准I/O重定向
查看>>
蓝桥杯c语言试题 高职,2011l蓝桥杯c语言高职真题附加答案2.doc
查看>>
c 语言 设计算法 例题,C语言程序设计例题.pdf
查看>>
p4 linux 命令行,《linux就该这么学》学习笔记25期2020-P4
查看>>
android9.0官方下载,安卓9.0系统刷机包 官方正式版
查看>>
android 模块封装,Android开发之针对联系人的封装
查看>>
android 构建期间错误,Android构建错误
查看>>
Android应用开发病虫害识别,基于Android平台的枣虫害识别系统的设计与实现
查看>>
织梦上传html文件,提高DedeCMS生成静态页html文件速度的方法
查看>>
html焦点自动轮播幻灯片js,js实现幻灯片轮播图
查看>>
在Logstash的配置文件中对日志事件进行区分
查看>>