library为私有库名称,一般不改, 比如docker search 10.1.11.194:5000/library/busybox
在 centos 中的位置是:/etc/sysconfig/docker
1. 私有库相关命令
1.1 镜像有关命令
1.1.1 查看pull下来的镜像的同时将images字符串格式化
[root@centos6u5 ~]# cat /var/lib/docker/repositories-devicemapper | python -mjson.tool
1.1.2 查询私有库里面的images
[root@centos6u5 ~]# docker search 10.1.11.194:5000/library
也可以使用下面命令查看
[root@centos6u5 /]# curl localhost:5000/v1/search | python -mjson.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
117 234 117 234 0 0 19586 0 --:--:-- --:--:-- --:--:-- 33428
{
"num_results": 4,
"query": "",
"results": [
{
"description": null,
"name": "library/mysql"
},
{
"description": null,
"name": "tutum/mysql"
},
{
"description": "",
"name": "library/ubuntu"
},
{
"description": "",
"name": "library/registry"
}
]
}
[root@centos6u5 /]#
1.1.3 私有库里面images的存放地址
[root@centos6u5 library]# ls /opt/data/registry/repositories/library
1.2 私有库镜像管理
1.2.1 首先查询私有库镜像
[root@centos6u5 library]# docker search 10.1.11.194:5000/library
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
library/busybox 0
library/tutum4mysql 0
library/ubuntu2 0
library/registry 0
library/mysql 0
library/mss 0
library/centos 0
library/ubuntu 0
[root@centos6u5 library]#
1.2.2 对上面的ubuntu镜像操作(GET)
[root@centos6u5 library]# curl -X GET localhost:5000/v1/repositories/library/ubuntu/tags
{"latest": "2103b00b3fdf1d26a86aded36ae73c1c425def0f779a6e69073b3b77377df348"}
[root@centos6u5 library]#
1.2.3 删除ubuntu镜像(DELETE)
[root@centos6u5 library]# curl -X DELETE localhost:5000/v1/repositories/library/Ubuntu/tags
True
[root@centos6u5 library]#
也可以后面加具体的tag,如下
[root@centos6u5 library]# curl -X DELETE localhost:5000/v1/repositories/library/busybox/tags/latest
true[root@centos6u5 library]#
1.2.4 再次获取该ubuntu镜像
[root@centos6u5 library]# curl -X GET localhost:5000/v1/repositories/library/ubuntu/tags
{"error": "Repository not found"}
[root@centos6u5 library]#
发现该镜像已经不存在了.
1.2.5 再次从私有库push该镜像
[root@centos6u5 library]# docker pull 10.1.11.194:5000/ubuntu
Pulling repository 10.1.11.194:5000/ubuntu
FATA[0002] Error: image ubuntu:latest not found
此时发现给image已经不存在了
1.2.6 再次查询私有库镜像列表
[root@centos6u5 library]# docker search 10.1.11.194:5000/library
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
library/busybox 0
library/tutum4mysql 0
library/ubuntu2 0
library/registry 0
library/mysql 0
library/mss 0
library/centos 0
[root@centos6u5 library]#
Ubuntu镜像已经被删除.