docker搭建私有仓库

 

registry私有仓库

下载docker-distribution软件包

yum install epel-release
yum install docker-distribution

查看docker-distribution配置文件

[root@localhost registry]# vim /etc/docker-distribution/registry/config.yml
version: 0.1                      #版本
log:
fields:
service: registry                #服务名称
storage:
cache:
layerinfo: inmemory
filesystem:
rootdirectory: /var/lib/registry      #镜像目录
http:
addr: :5000                    #docker-distribution监听的端口

启动服务

[root@localhost registry]# systemctl restart docker-distribution

查看5000端口是否启动

[root@localhost registry]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:111 *:*
LISTEN 0 5 192.168.122.1:53 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::5000 :::*
LISTEN 0 128 :::111 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*

查看本地镜像

[root@localhost registry]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
myos latest c14c79e9da64 4 weeks ago 466MB
centos latest 9f38484d220f 6 months ago 202MB

现在我们把centos这个镜像打上标签并且推送到registry中

[root@localhost registry]# docker tag centos 192.168.254.11:5000/centos:latest

[root@localhost registry]# docker push 192.168.254.11:5000/centos
The push refers to repository [192.168.254.11:5000/centos]
d69483a6face: Pushed
latest: digest: sha256:ca58fe458b8d94bc6e3072f1cfbd334855858e05e1fd633aa07cf7f82b048e66 size: 529

查看registry服务器

[root@localhost repositories]# ls -ltr /var/lib/registry/docker/registry/v2/repositories
total 0
drwxr-xr-x. 5 root root 55 Sep 13 10:28 centos
drwxr-xr-x. 5 root root 55 Sep 13 10:48 mysql

镜像已经上传上来了,OK

harbor私有仓库

下载harbor包

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

解压包并进入目录

tar -zxvf harbor-offline-installer-v1.4.0.tgz -C /usr/local/
cd /usr/local/harbor

编辑配置文件

vim harbor.cfg
hostname = 192.168.254.13 #对外访问地址
ui_url_protocol = http #访问方式
max_job_workers = 3 #最大处理进程数
customize_crt = on #是否要启动自定义证书,如果ui_url_protocol = http不生效,如果是https才会生效
  harbor_admin_password = Harbor12345 #admin用户的密码

执行文件

[root@master harbor]# ./install.sh
note:容器名字不能有registry这个名字,否则脚本执行失败

浏览器访问http://server_ip

创建项目

创建仓库

修改访问地址

[root@master harbor]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://l10nt4hq.mirror.aliyuncs.com"],
"insecure-registries":["192.168.254.13"]
}

重启docker服务

[root@master harbor]# service docker restart
Redirecting to /bin/systemctl restart docker.service

在linux下登录harbor

查看现有的镜像

[root@master harbor]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.aliyuncs.com/google_containers/kube-proxy v1.15.3 232b5c793146 3 weeks ago 82.4 MB
registry.aliyuncs.com/google_containers/kube-apiserver v1.15.3 5eb2d3fc7a44 3 weeks ago 207 MB
registry.aliyuncs.com/google_containers/kube-scheduler v1.15.3 703f9c69a5d5 3 weeks ago 81.1 MB
registry.aliyuncs.com/google_containers/kube-controller-manager v1.15.3 e77c31de5547 3 weeks ago 159 MB
docker.io/mariadb latest 99c1098d5884 4 weeks ago 355 MB
docker.io/mysql latest 62a9f311b99c 4 weeks ago 445 MB
quay.io/coreos/flannel v0.11.0-amd64 ff281650a721 7 months ago 52.6 MB
registry.aliyuncs.com/google_containers/coredns 1.3.1 eb516548c180 8 months ago 40.3 MB
registry.aliyuncs.com/google_containers/etcd 3.3.10 2c4adeb21b4f 9 months ago 258 MB
vmware/clair-photon v2.0.1-v1.4.0 a1df3526fe43 19 months ago 300 MB
vmware/notary-server-photon v0.5.1-v1.4.0 3edfddb8ece2 19 months ago 211 MB
vmware/notary-signer-photon v0.5.1-v1.4.0 cc70a05cdb6a 19 months ago 209 MB
vmware/registry-photon v2.6.2-v1.4.0 8920f621ddd1 19 months ago 198 MB
vmware/nginx-photon v1.4.0 20c8a01ac6ab 19 months ago 135 MB
vmware/harbor-log v1.4.0 9e818c7a27ab 19 months ago 200 MB
vmware/harbor-jobservice v1.4.0 29c14d91b043 19 months ago 191 MB
vmware/harbor-ui v1.4.0 6cb4318eda6a 19 months ago 210 MB
vmware/harbor-adminserver v1.4.0 8145970fa013 19 months ago 182 MB
vmware/harbor-db v1.4.0 c38da34727f0 19 months ago 521 MB
vmware/mariadb-photon v1.4.0 8457013cf6e3 19 months ago 521 MB
vmware/postgresql-photon v1.4.0 59aa61520094 19 months ago 221 MB
vmware/harbor-db-migrator 1.4 7a4d871b612e 20 months ago 1.15 GB
vmware/photon 1.0 9b411d78ad9e 20 months ago 130 MB
registry.aliyuncs.com/google_containers/pause 3.1 da86e6ba6ca1 21 months ago 742 kB

给要上传的包打标签

[root@master harbor]# docker tag docker.io/mysql:latest 192.168.254.13/databases/mysql:v1

上传镜像

[root@master harbor]# docker push 192.168.254.13/databases/mysql:v1
The push refers to a repository [192.168.254.13/databases/mysql]
647229410363: Pushed
5b96d5043191: Pushed
79a46f1eb9d0: Pushed
bdebd19e878f: Pushed
995fa4bb8afe: Pushed
bb1ef34119b2: Pushed
65430c57aee2: Pushed
1dd5f3e365cf: Pushed
7f33ce1066af: Pushed
9f77b78f01a7: Pushed
f5741d086b76: Pushed
8fa655db5360: Pushed
v1: digest: sha256:f0392b61ae096aef93b25f4b88206d774d2de1a7e43a7780a59a0c319c540b79 size: 2828

浏览器查看harbor

已经上传成功,ok

补充

开启或关闭harbor:

docker-compose up -d
docker-compose stop

docker 搭建私有云仓库的更多相关文章

  1. docker 搭建私有云盘 Seafile

    缘起 现如今各种云存储服务其实挺多的,国外有经典的DropBox.Google Drive.微软的OneDrive等,国内也有可以免费使用的各种云. 那么为什么想要搭建私有云存储呢?主要是本着“自己的 ...

  2. 【Docker】(4)搭建私有镜像仓库

    [Docker](4)搭建私有镜像仓库 说明 1. 这里是通过阿里云,搭建Docker私有镜像仓库. 2. 这里打包的镜像是从官网拉下来的,并不是自己项目创建的新镜像,主要测试功能 一.搭建过程 首先 ...

  3. [转]Ubuntu18.04下使用Docker Registry快速搭建私有镜像仓库

    本文转自:https://blog.csdn.net/BigData_Mining/article/details/88233015 1.背景 在 Docker 中,当我们执行 docker pull ...

  4. 手动搭建Docker本地私有镜像仓库

    实验环境:两个Centos7虚拟机,一个是Server,用作客户端,另一个是Registry,用作Docker私有镜像仓库. 基础配置 查看一下两台虚拟机的IP地址 Server的IP地址是192.1 ...

  5. Docker 搭建私有仓库

    Docker 搭建私有仓库 环境: docker 版本 :18.09.1 主机地址:192.168.1.79 1.运行并创建私有仓库 docker run -d \ -v /opt/registry: ...

  6. 菜鸟系列docker——搭建私有仓库harbor(6)

    docker 搭建私有仓库harbor 1. 准备条件 安装docker sudo yum update sudo yum install -y yum-utils device-mapper-per ...

  7. [Docker]docker搭建私有仓库(ssl、身份认证)

    docker搭建私有仓库(ssl.身份认证) 环境:CentOS 7.Docker 1.13.1 CentOS 7相关: https://www.cnblogs.com/ttkl/p/11041124 ...

  8. 在阿里云上搭建私有GIT仓库

    在阿里云上搭建私有GIT仓库 年轻人就得好好学习,不能这么颓废 最近做项目练练手,用到了github, 但是github访问速度是真的慢啊,下载项目,下载一天了.所以呢,我是个成熟的人了,只好自己搭建 ...

  9. 搭建docker registry私有镜像仓库

    搭建docker registry私有镜像仓库 一.安装docker-distribution yum install -y docker-distribution 安装完成后,启动服务: syste ...

随机推荐

  1. PythonCrashCourse 第七章习题

    编写一个程序,询问用户要租赁什么样的汽车,并打印一条消息,如"Let me see if I can find you a Subaru" car =input("Wha ...

  2. 封装Vue Element的form表单组件

    前两天封装了一个基于vue和Element的table表格组件,阅读的人还是很多的,看来大家都是很认同组件化.高复用这种开发模式的,毕竟开发效率高,代码优雅,逼格高嘛.虽然这两天我的心情很糟糕,就像& ...

  3. 启动tomcat出现闪退的原因

    出现闪退的可能有几点: 1.没有安装jdk或者配置jdk是否配置成功 2.找不到jdk安装的路径 3.tomcat环境配置失败 如果是第二点原因(确保第一第三点配置都正确无误)找不到jdk路径的话,可 ...

  4. Cirros镜像

    Openstack的开发,基本都使用这个image来测试,因为他比较小,只有10M. 镜像介绍 镜像的地址: https://launchpad.net/cirros/trunk/0.3.0/+dow ...

  5. 0基础算法基础学算法 第八弹 递归进阶,dfs第一讲

    最近很有一段时间没有更新了,主要是因为我要去参加一个重要的考试----小升初!作为一个武汉的兢兢业业的小学生当然要去试一试我们那里最好的几个学校的考试了,总之因为很多的原因放了好久的鸽子,不过从今天开 ...

  6. selenium定位方法实例

    selenium定位方法实例 首先打开浏览器输入微博的网址,将网页最大化,等待3秒 from selenium import webdriver import time driver = webdri ...

  7. WordCount of Software Engineering

    1.Github项目地址:https://github.com/BayardM/WordCount 2.PSP表格(before): PSP2.1 Personal Software Process ...

  8. 百度与谷歌seo优化的差别

    http://www.wocaoseo.com/thread-126-1-1.html 常有朋友问谷歌(google)和百度(baidu)到底有什么区别?我在纠结这个问题该如何回答.如果从公平公正的角 ...

  9. 百度统计可以查看用户IP

    http://www.wocaoseo.com/thread-123-1-1.html 本文来源于百度官方报道,据悉百度统计披露了访客IP地址,小编乐不可支.比起之前欲说还休的访客标识码,百度统计这次 ...

  10. webpack 打包的具体步骤

    webpack打包的方法: 方法一 创建一个src文件夹(存放自己的代码),dist文件夹(打包到此文件夹) 2编写自己的代码,在src文件夹中创建一个主模块main.js和若干个js文件,将模块js ...