查找registry 镜像

meiya@meiya:/etc/docker$ clear
meiya@meiya:/etc/docker$ docker search registry
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
registry The Docker Registry 2.0 implementation for s… [OK]
konradkleine/docker-registry-frontend Browse and modify your Docker registry in a … [OK]
hyper/docker-registry-web Web UI, authentication service and event rec… [OK]
atcol/docker-registry-ui A web UI for easy private/local Docker Regis… [OK]
distribution/registry WARNING: NOT the registry official image!!! … [OK]
jhipster/jhipster-registry JHipster Registry, based on Netflix Eureka a… [OK]
marvambass/nginx-registry-proxy Docker Registry Reverse Proxy with Basic Aut… [OK]
google/docker-registry Docker Registry w/ Google Cloud Storage driv…
confluentinc/cp-schema-registry Official Confluent Docker Images for Schema …
joxit/docker-registry-ui Docker registry v2 web User Interface [OK]
klausmeyer/docker-registry-browser Web Interface for the Docker Registry HTTP A… [OK]
openshift/origin-docker-registry The integrated OpenShift V3 registry
deis/registry Docker image registry for the Deis open sour…
quiq/docker-registry-ui Docker Registry UI
landoop/schema-registry-ui UI for Confluent's Schema Registry 7 [OK]
parabuzzle/docker-registry-ui Docker registry frontend for registry v2
anoxis/registry-cli You can list and delete tags from your priva… [OK]
elasticio/docker-registry-ecs Docker image to run Docker private registry … [OK]
allingeek/registry A specialization of registry: configured fo… [OK]
yammer/docker-registry-cache Simple docker registry cache using squid-pro… [OK]
webhippie/registry Docker images for Docker Registry [OK]
aibaars/docker-registry2-gcs Docker Registry2 w/ Google Cloud Storage dri…
convox/registry
lorieri/registry-ceph Ceph Rados Gateway (and any other S3 compati…
torchbox/kube-registry-proxy kube-registry-proxy fork with correct timeou… [OK]

拉取registry镜像

meiya@meiya:/etc/docker$ 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:3b00e5438ebd8835bcfa7bf5246445a6b57b9a50473e89c02ecc8e575be3ebb5
Status: Downloaded newer image for registry:latest

查看镜像

meiya@meiya:/etc/docker$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest f32a97de94e1 months ago .8MB

docker 镜像删除后会把所有的数据和文件都删除,所以要把宿主机的本地目录挂载到registry容器内部的目录上,在删除registry容器后依旧能保证文件和数据不丢失

meiya@meiya:/etc/docker$ mkdir -p ~/docker/data/registry
meiya@meiya:/etc/docker$ cd /
bin/ cdrom/ etc/ lib/ lost+found/ mnt/ proc/ run/ snap/ sys/ usr/
boot/ dev/ home/ lib64/ media/ opt/ root/ sbin/ srv/ tmp/ var/
meiya@meiya:/etc/docker$ cd /
bin/ cdrom/ etc/ lib/ lost+found/ mnt/ proc/ run/ snap/ sys/ usr/
boot/ dev/ home/ lib64/ media/ opt/ root/ sbin/ srv/ tmp/ var/
meiya@meiya:/etc/docker$ cd ~/docker/data/registry/
meiya@meiya:~/docker/data/registry$ pwd
/home/meiya/docker/data/registry
meiya@meiya:~/docker/data/registry$

创建registry镜像容器,绑定5000端口

meiya@meiya:~/docker/data/registry$ docker run -d -p : -v /home/meiya/docker/data/registry:/tmp/registry registry
0a922d940f7c9d7c4c3e4d81caaf3d5582e34fbb49e2824675b4c43b652e3240
meiya@meiya:~/docker/data/registry$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a922d940f7c registry "/entrypoint.sh /etc…" seconds ago Up seconds 0.0.0.0:->/tcp nifty_ganguly
meiya@meiya:~/docker/data/registry$ netstat -ntlp | grep
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 ::: :::* LISTEN -
meiya@meiya:~/docker/data/registry$ telnet 192.168.1.57
Trying 192.168.1.57...
Connected to 192.168.1.57.
Escape character is '^]'.
q
HTTP/1.1 Bad Request
Content-Type: text/plain; charset=utf-
Connection: close Bad RequestConnection closed by foreign host.
meiya@meiya:~/docker/data/registry$

将本地的镜像加上tag , 然后上传私服

meiya@meiya:~/docker/data/registry$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 27600aa3d7f1 hours ago 463MB
registry latest f32a97de94e1 months ago .8MB
meiya@meiya:~/docker/data/registry$ docker tag tomcat 192.168.1.57:/tomcat
meiya@meiya:~/docker/data/registry$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.1.57:/tomcat latest 27600aa3d7f1 hours ago 463MB
tomcat latest 27600aa3d7f1 hours ago 463MB
registry latest f32a97de94e1 months ago .8MB
meiya@meiya:~/docker/data/registry$ docker push 192.168.1.57:/tomcat
The push refers to repository [192.168.1.57:/tomcat]
Get https://192.168.1.57:5000/v2/: http: server gave HTTP response to HTTPS client
meiya@meiya:~/docker/data/registry$

这里出了个问题  ,主要是因为docker新版本默认不支持https协议,开放https协议

Get https://192.168.1.57:5000/v2/: http: server gave HTTP response to HTTPS client

解决办法,修改docker的配置文件,

修改默认的配置文件

sudo vi /etc/default/docker

加入

DOCKER_OPTS="--registry-mirror=https://registry.docker-cn.com --insecure-registry=192.168.1.57:5000"
# Docker Upstart and SysVinit configuration file

#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
# Please see the documentation for "systemd drop-ins":
# https://docs.docker.com/engine/admin/systemd/
# # Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd" # Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" DOCKER_OPTS="--registry-mirror=https://registry.docker-cn.com --insecure-registry=192.168.1.57:5000" # If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/" # This is also a handy place to tweak where Docker's temporary files go.
#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"

重启docker服务, 重启registry容器,重新push本地镜像

meiya@meiya:~/docker/data/registry$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
meiya@meiya:~/docker/data/registry$ docker run -d -p 5000:5000 -v /home/meiya/docker/data/registry:/tmp/registry registry
5b48b4c0147ceb6b7fec52943cd38420ac61ae488089326ff5b956b7c566f69e
meiya@meiya:~/docker/data/registry$ docker push 192.168.1.57:5000/tomcat
The push refers to repository [192.168.1.57:5000/tomcat]
d0830810b081: Pushed
32cddd6bb4cf: Pushed
f0e1731fd286: Pushed
2b6c38ff3137: Pushed
d38f3d5a39fb: Pushed
fe60061c6c4e: Pushed
7d63f8777ebf: Pushed
1b958b53b256: Pushed
2c719774c1e1: Pushed
ec62f19bb3aa: Pushed
f94641f1fe1f: Pushed
latest: digest: sha256:b3e89c95260685b18b31acb078b168c30a3b94ba561801bf374ccec0e7c622c6 size: 2626

ps:

第二种办法是修改  /etc/docker/daemon.json 文件,重启docker服务, 重启registry容器,重新push本地镜像

meiya@meiya:~/docker/data/registry$ cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://hdokp13m.mirror.aliyuncs.com"],
"insecure-registries":["192.168.1.57:5000"],
"registry-mirrors": ["https://registry.docker-cn.com"]
}

查看私有仓库中的镜像

meiya@meiya:~/docker/data/registry$ curl get http://192.168.1.57:5000/v2/_catalog
curl: (6) Could not resolve host: get
{"repositories":["tomcat"]}

 ps:

  部分旧的docker版本使用的地址是 http://192.168.1.57:5000/v2/_search

从私有仓库下载镜像

meiya@meiya:~/docker/data/registry$ docker pull 192.168.1.57:/tomcat
Using default tag: latest
latest: Pulling from tomcat
Digest: sha256:b3e89c95260685b18b31acb078b168c30a3b94ba561801bf374ccec0e7c622c6
Status: Image is up to date for 192.168.1.57:/tomcat:latest

docker 搭建私有 docker hub的更多相关文章

  1. 温故知新,基于Nexus3和Docker搭建私有Docker Mirrors镜像库

    前言 接着上一篇文章关于基于Nexus3和Docker搭建私有Nuget服务的探索,我们可以进一步利用Nexus3来创建一个私有的Docker镜像库满足内部需求. 仓库类型 hosted: 本地存储, ...

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

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

  3. Docker 搭建私有仓库

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

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

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

  5. docker 搭建私有云仓库

    docker搭建私有仓库   registry私有仓库 下载docker-distribution软件包 yum install epel-release yum install docker-dis ...

  6. 搭建私有Docker Registry

    Docker官方提供了用于搭建私有registry的镜像,并配有详细文档. 官方Registry镜像:https://hub.docker.com/_/registry 官方文档:https://do ...

  7. docker搭建私有registry

    搭建docker的私有registry 1.   registry简介 Docker在2015年推出了distribution项目,即Docker Registry 2.相比于old registry ...

  8. Docker搭建私有仓库

    1,下载仓库镜像. docker pull  registry    //主要用于搭建私有仓库的. 2,将宿主机端口映射到容器中去,容器的5000端口是不能更改的. docker run -d -p ...

  9. [转] 使用HTTPS在Nexus Repository Manager 3.0上搭建私有Docker仓库

    FROM: https://www.hifreud.com/2018/06/06/03-nexus-docker-repository-with-ssl/ 搭建方式 搭建SSL的Nexus官方提供两种 ...

随机推荐

  1. Codeforces 1137F Matches Are Not a Child's Play [LCT]

    Codeforces 很好,通过这题对LCT的理解又深了一层. 思路 (有人说这是套路题,然而我没有见过/kk) 首先发现,删点可以从根那里往下删,非常难受,所以把权值最大的点提为根. 然后考虑\(x ...

  2. 【随记】SQL Server配置管理器”远程过程调用失败“的问题解决

    打开配置管理器时出现如下错误: 问题原因: 在电脑上安装vs2012.vs2013,vs2015.vs2017.vs2019时会安装[Express LocalDB] 解决方案: 卸载所有[XXXLo ...

  3. JavaWeb之Tomcat(1) —— Tomcat的目录结构

    1. bin 文件夹 存放Tomcat的可执行文件 (1) startup.bat 文件,启动Tomcat服务的批处理文件. (2) shutdown.bat 文件,结束Tomcat服务的批处理文件. ...

  4. DNGuard HVM Unpacker(3.71 trial support and x64 fixed)

    DNGuard HVM Unpacker(3.71 trial support and x64 fixed) Gr8 news. Finally got the x64 crash fixed. DN ...

  5. R绘制韦恩图 | Venn图

    解决方案有好几种: 网页版,无脑绘图,就是麻烦,没有写代码方便 极简版,gplots::venn 文艺版,venneuler,不好安装rJava,参见Y叔 酷炫版,VennDiagram 特别注意: ...

  6. No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? idea maven 打包报错问题解决

    mvn clean install -X -Dmaven.test.skip=true -P dev 打包报错:No compiler is provided in this environment. ...

  7. Activity: launchMode 和 Intent.FLAG_ACTIVITY_CLEAR_TOP

    Activity 的 launchMode: 1. standard: 标准模式 这种启动模式为标准模式,也是默认模式.每当我们启动一个Activity,系统就会相应的创建一个实例,不管这个实例是否已 ...

  8. Flutter -------- dio网络请求

    dio是Flutter中文网开源的一个强大的Dart Http请求库,支持Restful API.FormData.拦截器.请求取消.Cookie管理.文件上传/下载.超时等... 1.添加依赖# d ...

  9. 【转载】 准人工智能分享Deep Mind报告 ——AI“元强化学习”

    原文地址: https://www.sohu.com/a/231895305_200424 ------------------------------------------------------ ...

  10. 四、postman增加断言

    预期和实际结果的判断 预期==实际:用例通过,写到报告里 预期!==实际:用例失败,写到报告里 一.例子演示 相当于首页右侧的10大每天的内容 url:http://www.v2ex.com/api/ ...