700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 【云原生 | 07】官方镜像仓库Docker Hub和企业级私有镜像仓库Harbor

【云原生 | 07】官方镜像仓库Docker Hub和企业级私有镜像仓库Harbor

时间:2018-12-17 13:47:04

相关推荐

【云原生 | 07】官方镜像仓库Docker Hub和企业级私有镜像仓库Harbor

🍁作者简介:🏅云计算领域优质创作者🏅新星计划第三季python赛道第一名🏅阿里云ACE认证高级工程师🏅

✒️个人主页:小鹏linux

💊个人社区:小鹏linux(个人社区)欢迎您的加入!

目录

1. Docker Hub

1.1Docker Hub注册和登录

1.2 从官方仓库进行镜像拉取

1.3自动创建

2. 阿里云镜像市场

2.1查看镜像

2.2下载镜像

3.搭建本地私有仓库

3.1使用registry镜像创建私有仓库

3.2Harbor-企业级docker私有仓库

👑👑👑结束语👑👑👑

1. Docker Hub

Dokcer Hub

1.1Docker Hub注册和登录

创建DockerHub账号

[root@localhost ~]# docker login Username: jamtur01 Password: Email: james@ Login Succeeded

1.2 从官方仓库进行镜像拉取

[root@localhost ~]# docker pull centosPullingrepositorycentos0b443ba03958:Downloadcomplete 539c0211cd76:Downloadcomplete 511136ea3c5a:Downloadcomplete 7064731afe90:Downloadcomplete

1.3自动创建

2. 阿里云镜像市场

2.1查看镜像

2.2下载镜像

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-vault-8.5.2111.repo

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-vault-8.5.2111.repo

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-7.repo

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-7.repo

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-vault-6.10.repo

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo /repo/Centos-vault-6.10.repo

3.搭建本地私有仓库

3.1使用registry镜像创建私有仓库

[root@localhost ~]# docker run -d -p 5000:5000 registry

[root@localhost ~]# docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registryregistry

3.2Harbor-企业级docker私有仓库

[root@localhost ~]# python #查看python环境,必须是2.7或更高版本

[root@localhost ~]# rz #上传harbor-offline-installer-v1.2.0.tgz压缩包[root@localhost ~]# tar xf harbor-offline-installer-v1.2.0.tgz #解压缩[root@localhost ~]# mv harbor /usr/local/[root@localhost ~]# cd /usr/local/harbor/[root@localhost harbor]# ls #查看[root@localhost harbor]# vim harbor.cfg #打开配置文件,进行如下修改

[root@localhost harbor]# mkdir -p /data/cert #创建证书存放路径[root@localhost cert]# chmod -R 777 /data/cert[root@localhost cert]# openssl genrsa -des3 -out server.key 2048#创建私钥,设置两次密码为123456[root@localhost cert]# openssl req -new -key server.key -out server.csr#然后输入私钥密码和其他信息[root@localhost cert]# cp server.key#备份私钥[root@localhost cert]# openssl rsa -in -out server.key #退密码处理,将server.key的密码取消掉[root@localhost cert]# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt[root@localhost cert]# cd -

[root@localhost harbor]# ./install.sh

[root@localhost harbor]# docker images #查看本地镜像[root@localhost harbor]# docker tag centos:centos7.9. /library/centos:centos7.9.#在项目中标记镜像[root@localhost harbor]# vim /etc/hosts #添加:192.168.232.165 [root@localhost harbor]# vim /etc/docker/daemon.json #打开配置文件,修改内容,添加信任域名,注意不要加协议,注意逗号。

{"registry-mirrors": ["https://kfp63jaj."]}

{"registry-mirrors": ["https://kfp63jaj."],"insecure-registries":[""]}

[root@localhost harbor]# docker login #输入账号admin和密码Harbor12345进行认证(docker logout 可以移除认证)[root@localhost harbor]# docker push /library/centos:centos7.9.#推送镜像到项目

👑👑👑结束语👑👑👑

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。