VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 网络工程 > Linux 教程 >
  • k8s之harbor私有镜像仓库部署

一、安装docker-compose

下载地址:https://github.com/docker/compose/releases

文件下载下来是个二进制文件,加x权限放到/usr/bin目录下


	
 
[root@node4 harbor]# ls
 
docker-compose-Linux-x86_64 harbor harbor-offline-installer-v2.3.1.tgz
 
[root@node4 harbor]# cp docker-compose-Linux-x86_64 /usr/bin/docker-compose
 
[root@node4 harbor]# chmod +x /usr/bin/docker-compose

二、安装harbor

下载地址:https://github.com/goharbor/harbor/releases

解压安装包,修改harbor.yml.tmpl文件并重命名成harbor.yml,这是harbor的配置文件,执行安装之前要改好,我这里只改了主机名和禁用了https


	
 
[root@node4 harbor]# ls
 
common docker-compose.yml harbor.yml install.sh prepare
 
common.sh harbor.v2.3.1.tar.gz harbor.yml.tmpl.bak LICENSE
 
 
 
[root@node4 harbor]# cat harbor.yml |grep hostname
 
# The IP address or hostname to access admin UI and registry service.
 
hostname: node4

在执行./install安装之前,确保docker处于运行状态。install完成后,默认使用80端口即访问。

image-20210807170941592

三、harbor启动与停止

启动,启动时要进入harbor的安装目录

docker-compose up -d

停止

docker-compose stop

四、docker登录harbor

http方式,需要修改/etc/dcoker/daemon.json


	
 
{
 
"insecure-registries": ["node4"]
 
}

登录


	
 
[root@node4 ~]# docker login 192.168.21.34
 
Authenticating with existing credentials...
 
Stored credentials invalid or expired
 
Username (admin):
 
Password:
 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
 
Configure a credential helper to remove this warning. See
 
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
 
 
 
Login Succeeded

五、上传镜像到仓库

先pull一个nginx:1.15到本地,打tag,上传


	
 
[root@node4 ~]# docker pull nginx:1.15
 
1.15: Pulling from library/nginx
 
743f2d6c1f65: Pull complete
 
6bfc4ec4420a: Pull complete
 
688a776db95f: Pull complete
 
Digest: sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68
 
Status: Downloaded newer image for nginx:1.15
 
docker.io/library/nginx:1.15
 
[root@node4 ~]# docker tag nginx:1.15 192.168.21.34/release/nginx:v1.15
 
[root@node4 ~]# docker push 192.168.21.34/release/nginx:v1.15
 
The push refers to repository [192.168.21.34/release/nginx]
 
332fa54c5886: Pushed
 
6ba094226eea: Pushed
 
6270adb5794c: Pushed
 
v1.15: digest: sha256:e770165fef9e36b990882a4083d8ccf5e29e469a8609bb6b2e3b47d9510e2c8d size: 94
 
8

=======================================================================

 

知识无边界,交流以长进

如需转载,请注明出处,谢谢

 

出处:https://www.cnblogs.com/mfyang/p/15133033.html


相关教程