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端口即访问。

三、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
展开阅读全文

页面更新:2024-04-21

标签:仓库   端口   主机名   权限   上传   方式   二进制文件   文件

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2008-2024 All Rights Reserved. Powered By bs178.com 闽ICP备11008920号-3
闽公网安备35020302034844号

Top