docker以distribution和registry管理个人镜像仓库

目录

一.distribution

1.扩展源下载docker-distribution并启动

2.打标签并认证安全仓库

3.推送到私人仓库

4.拉取镜像

二.registry

1.拉取registry的镜像

2.运行容器并打标签

3.认证安全仓库

4.推送到私人仓库

5.拉取镜像


一.distribution

1.扩展源下载docker-distribution并启动

[root@localhost ~]# yum info docker-distribution[root@localhost ~]# yum install -y docker-distribution.x86_64[root@localhost ~]# systemctl start docker-distribution[root@localhost ~]# cd /etc/docker-distribution/registry/[root@localhost registry]# cat config.yml 
version: 0.1
log:fields:service: registry
storage:cache:layerinfo: inmemoryfilesystem:rootdirectory: /var/lib/registry  #默认的镜像存放大致路径
http:addr: :5000   #端口

2.打标签并认证安全仓库

[root@localhost ~]# docker images
REPOSITORY                                           TAG         IMAGE ID       CREATED         SIZE
mysql                                                5.6         dd3b2a5dcb48   20 months ago   303MB
registry.cn-hangzhou.aliyuncs.com/su03/mycontainer   mysql_5.6   dd3b2a5dcb48   20 months ago   303MB
centos                                               latest      5d0da3dc9764   23 months ago   231MB
registry                                             2.6.2       10b45af23ff3   3 years ago     28.5MB
owncloud                                             latest      327bd201c5fb   4 years ago     618MB[root@localhost ~]# docker tag centos:latest 192.168.2.190:5000/centos:latest[root@localhost ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"insecure-registries": ["192.168.2.190:5000"]
}[root@localhost ~]# systemctl restart docker

3.推送到私人仓库

[root@localhost ~]# docker push 192.168.2.190:5000/centos:latest 
The push refers to repository [192.168.2.190:5000/centos]
74ddd0ec08fa: Pushed 
latest: digest: sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc size: 529[root@localhost ~]# ll /var/lib/registry/docker/registry/v2/repositories
total 0
drwxr-xr-x 5 root root 55 Aug 25 17:30 centos

4.拉取镜像

[root@localhost ~]# docker pull 192.168.2.190:5000/centos:latest 
latest: Pulling from centos
Digest: sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc
Status: Image is up to date for 192.168.2.190:5000/centos:latest
192.168.2.190:5000/centos:latest[root@localhost ~]# docker images
REPOSITORY                                           TAG         IMAGE ID       CREATED         SIZE
mysql                                                5.6         dd3b2a5dcb48   20 months ago   303MB
registry.cn-hangzhou.aliyuncs.com/su03/mycontainer   mysql_5.6   dd3b2a5dcb48   20 months ago   303MB
192.168.2.190:5000/centos                            latest      5d0da3dc9764   23 months ago   231MB
centos                                               latest      5d0da3dc9764   23 months ago   231MB
registry                                             2.6.2       10b45af23ff3   3 years ago     28.5MB
owncloud                                             latest      327bd201c5fb   4 years ago     618MB

二.registry

1.拉取registry的镜像

[root@localhost ~]# systemctl stop docker-distribution.service [root@localhost ~]# docker pull registry:2.6.2

2.运行容器并打标签

-v指定把镜像存储到宿主机的/registry目录下

[root@localhost ~]# docker run -itd --name myregistry -p 5000:5000 -v /registry:/var/lib/registry registry:2.6.2 
a2ddb1f22601398d13dcfcc2f6e495883d5b9cf52fce690eefbe8d0cfc787fd0[root@localhost ~]# docker tag nginx:latest 192.168.2.190:5000/nginx:latest

3.认证安全仓库

[root@localhost ~]# vim /etc/docker/daemon.json 
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"insecure-registries": ["192.168.2.190:5000"]
}[root@localhost ~]# systemctl restart docker

4.推送到私人仓库

[root@localhost ~]# docker push 192.168.2.190:5000/nginx:latest 
The push refers to repository [192.168.2.190:5000/nginx]
563c64030925: Pushed 
6fb960878295: Pushed 
e161c3f476b5: Pushed 
8a7e12012e6f: Pushed 
d0a62f56ef41: Pushed 
4713cb24eeff: Pushed 
511780f88f80: Pushed 
latest: digest: sha256:48a84a0728cab8ac558f48796f901f6d31d287101bc8b317683678125e0d2d35 size: 1778[root@localhost ~]# ll /registry/docker/registry/v2/repositories/
total 0
drwxr-xr-x 5 root root 55 Aug 25 18:09 nginx

5.拉取镜像

[root@localhost ~]# docker pull 192.168.2.190:5000/nginx:latest 
latest: Pulling from nginx
Digest: sha256:48a84a0728cab8ac558f48796f901f6d31d287101bc8b317683678125e0d2d35
Status: Image is up to date for 192.168.2.190:5000/nginx:latest
192.168.2.190:5000/nginx:latest[root@localhost ~]# docker images
REPOSITORY                                           TAG         IMAGE ID       CREATED         SIZE
192.168.2.190:5000/nginx                             latest      eea7b3dcba7e   9 days ago      187MB
nginx                                                latest      eea7b3dcba7e   9 days ago      187MB
mysql                                                5.6         dd3b2a5dcb48   20 months ago   303MB
registry.cn-hangzhou.aliyuncs.com/su03/mycontainer   mysql_5.6   dd3b2a5dcb48   20 months ago   303MB
192.168.2.190:5000/centos                            latest      5d0da3dc9764   23 months ago   231MB
centos                                               latest      5d0da3dc9764   23 months ago   231MB
registry                                             2.6.2       10b45af23ff3   3 years ago     28.5MB
owncloud                                             latest      327bd201c5fb   4 years ago     618MB

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/53757.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

leetcode 767. Reorganize String(重组字符串)

重新排列字符串s中的字母,使得任意两个相邻的字母都不相同。 思路: 让相邻字母不同,能想到的办法是先把相同的字母排列, 然后在相同字母的缝隙中插入另一种字母。 比如"aab", 先把"a a"排出来,再…

20-GIT版本控制

GIT 一 简介 场景 团队协作的时候,我们项目开发会遇到代码需要进行管理的场景。 多个开发者之间,每天写的代码可能需要合并,共享。 例子:我写的用户模块、小王写的订单模块,用户模块最终需要跟订单模块合并。 每天写完代码,qq、u盘拷贝,代码合并一个项目中。 希望…

RabbitMQ---订阅模型-Fanout

1、 订阅模型-Fanout Fanout,也称为广播。 流程图: 在广播模式下,消息发送流程是这样的: 1) 可以有多个消费者 2) 每个消费者有自己的queue(队列) 3) 每个队列都要绑定…

深度学习1.卷积神经网络-CNN

目录 卷积神经网络 – CNN CNN 解决了什么问题? 需要处理的数据量太大 保留图像特征 人类的视觉原理 卷积神经网络-CNN 的基本原理 卷积——提取特征 池化层(下采样)——数据降维,避免过拟合 全连接层——输出结果 CNN …

视频云存储/安防监控视频AI智能分析网关V3:抽烟/打电话功能详解

人工智能技术已经越来越多地融入到视频监控领域中,近期我们也发布了基于AI智能视频云存储/安防监控视频AI智能分析平台的众多新功能,该平台内置多种AI算法,可对实时视频中的人脸、人体、物体等进行检测、跟踪与抓拍,支持口罩佩戴检…

2023年下软考信息安全工程师报名时间及汇总(附备考攻略)

信息安全工程师是近几年新增的中级考试科目,一般在下半年考试,难度还是有的,但是只要你有恒心,愿意付出,认真刷题备考,拿下证书还是没有问题的! 2023年下半年由于考试改革,报名时间…

【ArcGIS微课1000例】0072:如何生成空间权重矩阵

严重声明:本文来自专栏《ArcGIS微课1000例:从点滴到精通》,为CSDN博客专家刘一哥GIS原创,原文及专栏地址为:(https://blog.csdn.net/lucky51222/category_11121281.html),谢绝转载或爬取!!! 文章目录 一、空间权重矩阵工具介绍二、ArcGIS生成空间权重矩阵三、注意事项…

npm 安装 git 仓库包

安装 #v1.0.0 代表版本, 例如打了仓库一个tag叫v1.0.0; 如果不指定版本则默认是最新的代码仓库代码要包含打过包的代码page.json 要配置好相关字段, 按照npm包的格式就好 npm install githttp://mygitlab.xxxx.net/chengchongzhen/hex-event-track.git#v1.0.0其他方式, 将仓库代…

35. 搜索插入位置(简单系列)

给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 请必须使用时间复杂度为 O(log n) 的算法。 示例 1: 输入: nums [1,3,5,6], target 5 输出: 2 示例 2: 输入…

用 Audacity 比较两段音频差异

工作中遇到相同的处理流程,处理同一段音频,看看处理结果是否一致,可以用audacity来处理。 假设待比较的音频分别为 1.wav 2.wav 1、用Audacity打开1.wav 2、用Audacity打开2.wav,选中音频,然后用 效果 -> 反向&am…

Leetcode77. 组合

给定两个整数 n 和 k&#xff0c;返回范围 [1, n] 中所有可能的 k 个数的组合。 你可以按 任何顺序 返回答案。 回溯剪枝 力扣&#xff08;LeetCode&#xff09;官网 - 全球极客挚爱的技术成长平台 class Solution {public List<List<Integer>> combine(int n, i…

LeetCode 43题:字符串相乘

题目 给定两个以字符串形式表示的非负整数 num1 和 num2&#xff0c;返回 num1 和 num2 的乘积&#xff0c;它们的乘积也表示为字符串形式。 注意&#xff1a;不能使用任何内置的 BigInteger 库或直接将输入转换为整数。 示例 1: 输入: num1 "2", num2 "3&…

stm32之12.如何使用printf打印输出

主函数增加这些代码即可实现printf打印输出 需要添加头文件 #include "stdio.h" --------------- 源码 struct __FILE { int handle; /* Add whatever you need here */ }; FILE __stdout; FILE __stdin; int fputc(int c, FILE *f) { /* 发送一个字节 */ …

解决MyBatis不能将表中含有下划线的字段映射到实体属性的两种方案

版权声明 本文原创作者&#xff1a;谷哥的小弟作者博客地址&#xff1a;http://blog.csdn.net/lfdfhl 问题描述 MyBatis不能准确地将表中含有下划线的字段映射到实体属性。例如&#xff1a;表中的列名为&#xff1a;user_name&#xff0c;实体类中的属性为&#xff1a;userNa…

《C和指针》笔记7: int和char数据类型的范围

数据类型字节数位数范围char18位-128-127 ( − 2 7 − 2 7 − 1 ) (-2^7 - 2^7-1) (−27−27−1)signed char18位-128-127 ( − 2 7 − 2 7 − 1 ) (-2^7 - 2^7-1) (−27−27−1)unsigned char18位0-255 ( 0 − 2 8 − 1 ) (0 - 2^8-1) (0−28−1)short int216位-32768&…

leetcode做题笔记104. 二叉树的最大深度

给定一个二叉树 root &#xff0c;返回其最大深度。 二叉树的 最大深度 是指从根节点到最远叶子节点的最长路径上的节点数。 思路一&#xff1a;递归 int dfs(struct TreeNode* node){int rdepth 1;int ldepth 1;if(node->left!NULL) ldepth rdepth dfs(node->lef…

重要通知:9月1日起,微信小程序须完成备案后才可上架

微信官方通知 近日&#xff0c;工信部发布了《工业和信息化部关于开展移动互联网应用程序备案工作的通知》&#xff0c;8月9日&#xff0c;微信公众平台也发布了“关于开展微信小程序备案的通知”&#xff1a; 一、备案必要性 在中华人民共和国境内从事互联网信息服务的移动互…

springboot定时任务:同时使用定时任务和websocket报错

背景 项目使用了websocket,实现了消息的实时推送。后来项目需要一个定时任务&#xff0c;使用org.springframework.scheduling.annotation的EnableScheduling注解来实现&#xff0c;启动项目之后报错 Bean com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration of t…

Python爬虫分布式架构问题汇总

在使用Python爬虫分布式架构中可能出现以下的问题&#xff0c;我们针对这些问题&#xff0c;列出相应解决方案&#xff1a; 1、任务重复执行 在分布式环境下&#xff0c;多个爬虫节点同时从消息队列中获取任务&#xff0c;可能导致任务重复执行的问题。 解决方案&#xff1a;…

springboot整合jdbctemplate教程

这篇文章介绍一下springboot项目整合jdbctemplate的步骤&#xff0c;以及通过jdbctemplate完成数据库的增删改查功能。 目录 第一步&#xff1a;准备数据库 第二步&#xff1a;创建springboot项目 1、创建一个springboot项目并命名为jdbctemplate 2、添加spring-jdbc和项目…