Docker私有仓库2
https://www.cnblogs.com/zeppelin/p/5906410.html
接着上篇,上面为上篇地址。
#通过docker tag将该镜像标志为要推送到私有仓库
[root@lh- ~]# sudo docker tag ubuntu 192.168.0.34:/ubuntu
Error response from daemon: no such id: ubuntu
[root@lh- ~]# sudo docker tag docker.io/ubuntu 192.168.0.34:/ubuntu
Error response from daemon: no such id: docker.io/ubuntu
[root@lh- ~]# sudo docker tag 3876b81b5a81 192.168.0.34:/ubuntu
#查看镜像
[root@lh- ~]# docker images
192.168.0.34:/ubuntu latest 3876b81b5a81 months ago 187.9 MB
docker.io/ubuntu 14.04. 3876b81b5a81 months ago 187.9 MB
#提交ubuntu镜像到私有仓库
[root@lh- ~]# sudo docker push 192.168.0.34:/ubuntu
The push refers to a repository [192.168.0.34:/ubuntu]
5f70bf18a086: Pushed
0d81735d8272: Pushed
982549bd6b32: Pushed
8698b31c92d5: Pushed
latest: digest: sha256:a47804d268c600572aab1f564e38d1ef009bd7c7ce4bbd325be51973541e5431 size:
#进入容器
[root@lh- data]# docker exec -it 6cb333619b90 /bin/sh
/ # ls
bin entrypoint.sh home linuxrc mnt root sbin sys usr
dev etc lib media proc run srv tmp var
/ # cd /tmp/registry/
/tmp/registry # ls
/tmp/registry #
发现还是没有镜像
#镜像在容器的/var/lib/registry目录下
~ # cd /var/lib/registry/docker/registry/v2/repositories/
/var/lib/registry/docker/registry/v2/repositories # ls
busybox nginx ubuntu
/var/lib/registry/docker/registry/v2/repositories # ll
/bin/sh: ll: not found
/var/lib/registry/docker/registry/v2/repositories # ls -l
total
drwxr-xr-x root root Sep : busybox
drwxr-xr-x root root Sep : nginx
drwxr-xr-x root root Sep : ubuntu
/var/lib/registry/docker/registry/v2/repositories #
#切换映射目录
[root@lh- registry]# docker run -d -p : -v /opt/data/registry:/var/lib/registry docker.io/registry
bc2304a84ec4cd7eed6b0dabd929141990d2e4f11253941a1fe28856c255aa06
[root@lh- registry]# docker push 192.168.0.34:/busybox
The push refers to a repository [192.168.0.34:/busybox]
8ac8bfaff55a: Retrying in seconds
Received unexpected HTTP status: Internal Server Error
问题:push镜像报错。
#解决办法:
给这个容器扩展的特权--privileged=true
[root@lh- registry]# docker run -d -p : -v /opt/data/registry:/var/lib/registry --privileged=true docker.io/registry
23397ef79ec57f6a077dd50c8ff449c3a1dd6b21b8c13f6e210775ec0975412e
注:这儿只有加特权才可行,后面我用了registry:2镜像没有这个问题了,估计是最新版本镜像的问题吧。
#提交镜像到本地仓库中
[root@lh- registry]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.0.34:/busybox latest 2b8fd9751c4c weeks ago 1.093 MB
[root@lh- registry]# docker push 192.168.0.34:/busybox
The push refers to a repository [192.168.0.34:/busybox]
8ac8bfaff55a: Pushed
latest: digest: sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6 size:
发现可以push上去了。
[root@lh- registry]# ls /opt/data/registry/docker/registry/v2/repositories/
Busybox
[root@lh- registry]# curl -XGET 192.168.0.34:/v2/_catalog
{"repositories":["busybox"]}
#进入容器看一下镜像实际存储位置
[root@lh- registry]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
23397ef79ec5 docker.io/registry "/entrypoint.sh /etc/" minutes ago Up minutes 0.0.0.0:->/tcp berserk_hypatia
[root@lh- registry]# docker exec -it 23397ef79ec5 /bin/sh
/ # ls
bin entrypoint.sh home linuxrc mnt root sbin sys usr
dev etc lib media proc run srv tmp var
/ # cd /var/lib/registry/docker/registry/v2/repositories/
/var/lib/registry/docker/registry/v2/repositories # ls
busybox
#查看镜像的存储目录树
[root@lh- registry]# tree /opt/data/registry/docker/registry/v2/repositories/
/opt/data/registry/docker/registry/v2/repositories/
└── busybox
├── _layers
│ └── sha256
│ ├── 2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749
│ │ └── link
│ └── 8ddc19f16526912237dd8af81971d5e4dd0587907234be2b83e249518d5b673f
│ └── link
├── _manifests
│ ├── revisions
│ │ └── sha256
│ │ └── a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6
│ │ └── link
│ └── tags
│ └── latest
│ ├── current
│ │ └── link
│ └── index
│ └── sha256
│ └── a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6
│ └── link
└── _uploads directories, files
测试放到下篇。
https://www.cnblogs.com/zeppelin/p/5906444.html
个人公众号,定期分享大数据与知识图谱相关知识点,读书思考:
Docker私有仓库2的更多相关文章
- 一步步搭建docker私有仓库并从私有仓库中下载镜像
一步步搭建docker私有仓库 #下载镜像 docker pull registry#查看镜像 docker images #运行私有仓库,指定端口和数据卷 docker run -d -p : -v ...
- 搭建docker私有仓库,建立k8s集群
服务器IP角色分布 192.168.5.2 etcd server 192.168.5.2 kubernetes master 192.168.5.3 kubernetes node 192.168. ...
- docker 私有仓库镜像的存储位置
docker 私有仓库的镜像 是存储在5739360d1030 registry "docker-registry" 3 days ago Up 28 hours 0.0.0.0: ...
- 在docker私有仓库如何查看有哪些镜像?
搭建了docker私有仓库,上传了一些镜像,时间长了就会忘了有哪些镜像,在网上查了,有大佬是通过脚本查看的,多厉害! #!/usr/bin/env python#-*- coding:utf-8 -* ...
- 转载:教你分分钟搞定Docker私有仓库Registry
一.什么是Docker私有仓库Registry 官方的Docker hub是一个用于管理公共镜像的好地方,我们可以在上面找到我们想要的镜像,也可以把我们自己的镜像推送上去.但是,有时候我们的服务器无法 ...
- Docker 私有仓库建立(加密和用户验证)
(一)生成证书1.mkdir /certs2.cd /certs 3.生成自签名证书 sudo openssl req -newkey rsa:2048 -new -nodes -x509 -days ...
- 搭建docker私有仓库(https)
1.修改openssl.cnf,支持IP地址方式,HTTPS访问在Redhat7或者Centos系统中,文件所在位置是/etc/pki/tls/openssl.cnf.在其中的[ v3_ca]部分,添 ...
- 搭建docker私有仓库
保存镜像的地方成为仓库(registry).目前有2种仓库:公共仓库和私有仓库. 最方便的是使用公共仓库上传和下载镜像,下载不需要注册,上传需要到公共仓库注册.公共仓库网站:https://hub.d ...
- 教你分分钟搞定Docker私有仓库Registry
一.什么是Docker私有仓库Registry 官方的Docker hub是一个用于管理公共镜像的好地方,我们可以在上面找到我们想要的镜像,也可以把我们自己的镜像推送上去.但是,有时候我们的服务器无法 ...
- docker 私有仓库简易搭建
概要 本地私有仓库 局域网私有仓库 总结 概要 docker hub 使用非常方便,而且上面有大量的镜像可以使用. 但是,每次都远程下载镜像速度非常慢,如果能在本地做一个 docker 的仓库,多人协 ...
随机推荐
- Makefile.am编写规则
概念 Makefile.am是比Makefile更高层次的规则只需要指定要生成什么目标,依赖于什么文件,和要安装到什么目录.automake会根据Makefile.am来自动生成Makefile.in ...
- Java中IO流
* IO流用来处理设备之间的数据传输 * Java对数据的操作是通过流的方式 * Java用于操作流的类都在IO包中 * 流按流向分为两种:输入流,输出流. * 流按操作类型分为两种: * 字节流 : ...
- USACO 3.3 Riding the Fences
Riding the Fences Farmer John owns a large number of fences that must be repaired annually. He trave ...
- GL应用方面
1.图和表 2.计算机辅助设计CAD 3.虚拟现实环境 4.数据可视化 5.教学与培训(基于VR) 6.计算机艺术 7.娱乐 8.图像处理 9.用户界面
- DB2数据库实例创建与删除 学习笔记
以root身份执行 $DB2HOME/instance/db2idrop -f 实例名,注意一定要加-f,否则不会删除实例下面sqllib文件.如果不幸忘了,执行db2icrt,会报sqllib文件存 ...
- Python调用(运行)外部程序
在Python中可以方便地使用os模块运行其他的脚本或者程序,这样就可以在脚本中直接使用其他脚本,或者程序提供的功能,而不必再次编写实现该功能的代码.为了更好地控制运行的进程,可以使用win32pro ...
- sharepoint:基于AD的FORM认证
//来源:http://www.cnblogs.com/jindahao/archive/2012/05/07/2487351.html 需求: 1. 认证要基于AD 2. 登入方式要页面的方式(fo ...
- php笔记(六)PHP类与对象之对象接口
接口的实现 <?php //interface 关键字用于定义一个接口 interface ICanEat{ //接口里面的方法不需要实现 public function eat($food); ...
- 推荐几个好的 Maven 常用仓库网址
注意,以下内容转载自:推荐几个好的 Maven 常用仓库网址 Maven 确确实实是个好东西,用来管理项目显得很方便,但是如果是通过 Maven 来远程下载 JAR 包的话,我宿舍的带宽是4兆的,4个 ...
- python报错Could not open PYTHONSTARTUP
root@liqian-python:/pythonShare/monitor/m_server/core# pythonPython 2.7.10 (default, Oct 14 2015, 16 ...