利用docker搭建本地私有镜像仓库
主机名 | 角色 |
sht-sgmhadoopcm-01 | Docker Repository |
sht-sgmhadoopnn-01 |
Docker Client |
1. 在两台节点分别安装docker
https://www.cnblogs.com/ilifeilong/p/11687143.html
2. cm-01节点下载docker官方提供的registry镜像
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE # docker search registry
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
registry The Docker Registry 2.0 implementation for s… [OK]
................. # docker pull registry
Using default tag: latest
latest: Pulling from library/registry
c87736221ed0: Pull complete
1cc8e0bb44df: Pull complete
54d33bcb37f5: Pull complete
e8afc091c171: Pull complete
b4541f6d3db6: Pull complete
Digest: sha256:8004747f1e8cd820a148fb7499d71a76d45ff66bac6a29129bfdbfdc0154d146
Status: Downloaded newer image for registry:latest
docker.io/library/registry:latest # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest f32a97de94e1 months ago .8MB
3.cm-01节点新建registry容器
# docker run --detach --publish 5000:5000 --name registry-container --hostname registry registry
191a5a61a411b4ffc3a2edb43c3b675d30c2e52365044333f065297af02b9a81
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
191a5a61a411 registry "/entrypoint.sh /etc…" 7 seconds ago Up 5 seconds 0.0.0.0:5000->5000/tcp registry-container
查看当前registry镜像仓库,当前并未有任何镜像
# curl -X GET http://sht-sgmhadoopcm-01:5000/v2/_catalog
{"repositories":[]}
4. 在nn-01节点上模拟客户端上传和下载镜像
新建或修改文件daemon.json,添加如下内容
# cat /etc/docker/daemon.json
{
"registry-mirror": [
"https://registry.docker-cn.com"
],
"insecure-registries": [
"sht-sgmhadoopcm-01:5000"
]
}
重启docker服务
# systemctl stop docker
# systemctl start docker
上传镜像
为需要上传的映像文件添加新的tag
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos/mysql version7 b7138378001a hours ago .57GB
cenots/centos7-mysql57 latest d46f0eee5c07 hours ago .94GB
centos version7. babd2f913fc9 hours ago 262MB
centos version7 0f3e07c0138f weeks ago 220MB # docker tag centos/mysql:version7 sht-sgmhadoopcm-:/centos/mysql:version7 # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos/mysql version7 b7138378001a hours ago .57GB
sht-sgmhadoopcm-:/centos/mysql version7 b7138378001a hours ago .57GB
cenots/centos7-mysql57 latest d46f0eee5c07 hours ago .94GB
centos version7. babd2f913fc9 hours ago 262MB
centos version7 0f3e07c0138f weeks ago 220MB
上传镜像至registry
# docker push sht-sgmhadoopcm-:/centos/mysql
The push refers to repository [sht-sgmhadoopcm-:/centos/mysql]
3cd7cc19db60: Pushed
version7: digest: sha256:e74958454feca52975d3a1ef6f4147bd68dab2c8200d9626ea017f2f5ae7e20b size:
在registry查看镜像
# curl -X GET http://sht-sgmhadoopcm-01:5000/v2/_catalog
{"repositories":["centos/mysql"]} # curl -X GET http://sht-sgmhadoopcm-01:5000/v2/centos/mysql/tags/list
{"name":"centos/mysql","tags":["version7"]}
下载镜像
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos version7. babd2f913fc9 hours ago 262MB
centos version7 0f3e07c0138f weeks ago 220MB # docker pull sht-sgmhadoopcm-:/centos/mysql:version7
version7: Pulling from centos/mysql
2dedd01a3283: Pull complete
Digest: sha256:e74958454feca52975d3a1ef6f4147bd68dab2c8200d9626ea017f2f5ae7e20b
Status: Downloaded newer image for sht-sgmhadoopcm-:/centos/mysql:version7
sht-sgmhadoopcm-:/centos/mysql:version7 # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sht-sgmhadoopcm-:/centos/mysql version7 b7138378001a hours ago .57GB
centos version7. babd2f913fc9 hours ago 262MB
centos version7 0f3e07c0138f weeks ago 220MB
为了方便使用,将下载下来的镜像重命名
# docker tag sht-sgmhadoopcm-:/centos/mysql:version7 centos/mysql:version7 # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos/mysql version7 b7138378001a hours ago .57GB
sht-sgmhadoopcm-:/centos/mysql version7 b7138378001a hours ago .57GB
centos version7. babd2f913fc9 hours ago 262MB
centos version7 0f3e07c0138f weeks ago 220MB
# docker rmi sht-sgmhadoopcm-:/centos/mysql:version7
Untagged: sht-sgmhadoopcm-:/centos/mysql:version7
Untagged: sht-sgmhadoopcm-:/centos/mysql@sha256:e74958454feca52975d3a1ef6f4147bd68dab2c8200d9626ea017f2f5ae7e20b # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos/mysql version7 b7138378001a hours ago .57GB
centos version7. babd2f913fc9 hours ago 262MB
centos version7 0f3e07c0138f weeks ago 220MB
利用docker搭建本地私有镜像仓库的更多相关文章
- 03: 使用docker搭建Harbor私有镜像仓库
1.1 harbor介绍 1.Harbor简介 1. Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器. 2. 镜像的存储harbor使用的是官方的docker regi ...
- 搭建Harbor私有镜像仓库--v1.5.1
搭建Harbor私有镜像仓库--v1.5.1 1.介绍 Docker容器应用的开发和运行离不开可靠的镜像管理,虽然Docker官方也提供了公共的镜像仓库,但是从安全和效率等方面考虑,部署我们私有环境 ...
- 利用Docker搭建本地https环境的完整步骤
利用Docker搭建本地https环境的完整步骤 这篇文章主要给大家介绍了关于如何利用Docker搭建本地https环境的完整步骤,文中通过示例代码将实现的步骤介绍的非常详细,对大家的学习或者工作具有 ...
- 利用 Docker 搭建 IPFS 私有网络
利用 Docker 搭建 IPFS 私有网络 本文原始地址:https://sitoi.cn/posts/40630.html 下载项目 项目地址:https://github.com/Sitoi/p ...
- 手动搭建Docker本地私有镜像仓库
实验环境:两个Centos7虚拟机,一个是Server,用作客户端,另一个是Registry,用作Docker私有镜像仓库. 基础配置 查看一下两台虚拟机的IP地址 Server的IP地址是192.1 ...
- docker搭建harbor私有镜像库
创建harbor私有镜像库 一.部署准备: harbor软件包 在部署节点上: 1)解压harbor的软件包将harbor目录下所有文件发送到/opt/目录下 tar zxvf harbor- ...
- [Docker]Harbor部署私有镜像仓库
Harbor部署私有镜像仓库 认识: Harbor 是一个用于存储和分发 Docker 镜像的企业级 Registry 服务器. 部署环境: CentOS7 Python2.7.5 Docker CE ...
- docker实战——Docker本地私有镜像仓库Harbor搭建及配置
Harbor介绍 Docker容器应用的开发和运行离不开可靠的镜像管理,虽然docker官方提供了公共的镜像仓库(Docker Hub),但是从安全和效率等方面考虑,部署我们私有环境内的Registr ...
- docker 搭建本地私有仓库
1.使用registry镜像创建私有仓库 安装docker后,可以通过官方提供的 registry 镜像来简单搭建一套本地私有仓库环境: docker run -d -p : registry: 这将 ...
随机推荐
- k8s权威指南-从xx到oo的实践全接触
基本概念与术语 集群的2种管理角色:master和node master 集群的控制节点,负责整个集群的管理与控制,运行着关键进程: 1,k8s api server: 提供了HTTP Rest 接口 ...
- Harmonic Number (LightOJ 1234)(调和级数 或者 区块储存答案)
题解:隔一段数字存一个答案,在查询时,只要找到距离n最近而且小于n的存答案值,再把剩余的暴力跑一遍就可以. #include <bits/stdc++.h> using namespace ...
- Konrad and Company Evaluation
F. Konrad and Company Evaluation 参考:[codeforces 1230F]Konrad and Company Evaluation-暴力 思路:题意分析见参考博客. ...
- 微信小程序_(校园视)开发上传视频业务
微信小程序_(校园视) 开发用户注册登陆 传送门 微信小程序_(校园视) 开发上传视频业务 传送门 微信小程序_(校园视) 开发视频的展示页-上 传送门 微信小程序_(校园视) 开发视频的展示页-下 ...
- $\LaTeX$数学公式大全8
$8\ Miscellaneous\ symbols$ $\infty$ \infty $\nabla$ \nabla $\partial$ \partial $\eth$ \eth $\clubsu ...
- [题解] [SCOI2010] 生成字符串
题面 题解 考虑到直接求合法方案不好求, 我们转化为用总方案减去不合法方案 总方案就是\(\binom{n+m}{m}\), 即在\(n+m\)个位置中放\(n\)个数 我们将初始的空序列看做\((0 ...
- java获取本机mac物理地址
package com.simonjia.util.other; import java.net.InetAddress;import java.net.InterfaceAddress;import ...
- tp5分页,一看就懂,简单明了(附带额外参数)
php 代码: $result = $jjModel->where($wheres)->paginate(10,false,['query' => ['peytype'=>$p ...
- koa 基础(六)应用级路由中间件
1.应用级路由中间件 app.js /** * 应用级路由中间件 */ // 引入模块 const Koa = require('koa'); const router = require('koa- ...
- leetcode1282 用户分组
class Solution { public: vector<vector<int>> groupThePeople(vector<int>& group ...