Dokcer创建私有仓库私有仓库Web管理
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Dokcer创建私有仓库私有仓库Web管理相关的知识,希望对你有一定的参考价值。
1、直接用Docker提供的镜像registry运行私有仓库
# docker run -d -p 5000:5000 -v /data/registry:/var/lib/registry --name registry --restart=‘always‘ registry
-d : 后台运行
-p : 宿主机跟容器映射端口 SERVER_PORT:CONTAINER_PORT
-v : 挂载宿主机目录到容器中作为数据卷, docker registry上传镜像默认存放到容器/var/lib/registry,将本地/data/registry目录挂载到容器中,避免删除容器是数据丢失
--name : 容器名称,不配置将随机生成
--restart: 重启策略,这里配置为always为任何时候
2、查看仓库是否正常
# curl http://192.168.62.200:5000/v2/ {}
# curl -XGET http://192.168.62.200:5000/v2/_catalog {"repositories":["saltruler_web","ubuntu"]}
3、查看本地images
# docker images REPOSITORY TAG IMAGE ID CREATED SIZE saltops v3 f86ee612af8f 20 minutes ago 580 MB saltops v2 f851c8406430 5 hours ago 580 MB saltops latest b8246781274a 6 hours ago 509 MB centos/resin 3.1.8 24b506c6b19a 4 days ago 450 MB 192.168.62.200:5000/saltruler_web latest a2e9e9205aea 4 days ago 966 MB saltruler_web latest a2e9e9205aea 4 days ago 966 MB djangotest_web latest 3c00ad940197 5 days ago 722 MB mysql latest 9546ca122d3a 11 days ago 407 MB python 3.4 c588c14f484e 2 weeks ago 684 MB python 2.7 68caceba17ab 2 weeks ago 677 MB postgres latest 9910dc9f2ac0 2 weeks ago 267 MB centos latest 98d35105a391 3 weeks ago 192 MB mycentos latest 98d35105a391 3 weeks ago 192 MB jdeathe/centos-ssh-apache-php latest c2ae3c97feb1 4 weeks ago 284 MB registry 2 047218491f8c 5 weeks ago 33.2 MB registry latest 047218491f8c 5 weeks ago 33.2 MB redis latest e4a35914679d 5 weeks ago 183 MB nginx latest 6b914bbcb89e 5 weeks ago 182 MB registry 2.1.1 52bb991b482e 17 months ago 220 MB
4、标记上传的镜像
# docker tag saltops:v3 192.168.62.200:5000/saltops:v3 # docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.62.200:5000/saltops v3 f86ee612af8f 22 minutes ago 580 MB saltops v3 f86ee612af8f 22 minutes ago 580 MB saltops v2 f851c8406430 5 hours ago 580 MB saltops latest b8246781274a 6 hours ago 509 MB centos/resin 3.1.8 24b506c6b19a 4 days ago 450 MB 192.168.62.200:5000/saltruler_web latest a2e9e9205aea 4 days ago 966 MB saltruler_web latest a2e9e9205aea 4 days ago 966 MB djangotest_web latest 3c00ad940197 5 days ago 722 MB mysql latest 9546ca122d3a 11 days ago 407 MB python 3.4 c588c14f484e 2 weeks ago 684 MB python 2.7 68caceba17ab 2 weeks ago 677 MB postgres latest 9910dc9f2ac0 2 weeks ago 267 MB mycentos latest 98d35105a391 3 weeks ago 192 MB centos latest 98d35105a391 3 weeks ago 192 MB jdeathe/centos-ssh-apache-php latest c2ae3c97feb1 4 weeks ago 284 MB registry 2 047218491f8c 5 weeks ago 33.2 MB registry latest 047218491f8c 5 weeks ago 33.2 MB redis latest e4a35914679d 5 weeks ago 183 MB nginx latest 6b914bbcb89e 5 weeks ago 182 MB registry 2.1.1 52bb991b482e 17 months ago 220 MB
5、push上传到私有仓库
# docker push 192.168.62.200:5000/saltops:v3 The push refers to a repository [192.168.62.200:5000/saltops] d8d7b4725725: Pushed 81e97be478f1: Pushed f245be9edb71: Pushed 9b198ff9ff5b: Pushed v3: digest: sha256:4a7c610dbeab40a25486b6d8eb7b98bc95c585d1c3fc1f99c34a06348eea0c19 size: 1162
6、查看刚刚上传到私有仓库的saltops
# curl -XGET http://192.168.62.200:5000/v2/saltops/tags/list {"name":"saltops","tags":["v3"]}
7、部署私有仓库管理UI,
小蜗牛收集以下三种Docker Registry 管理 UI,Breezes亲测使用
I、Breezes : Breezes 是一个多中心和多版本的 Docker Registry 管理 UI,
I、Breezes部署
安装Breezes
git clone https://git.oschina.net/kbsonlong/Breezes.git cd Breezes/ yum install -y gcc gcc-c++ python-devel pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
启动Breezes
# sh Control.sh Breezes start over. # netstat -ntlp|grep Breezes tcp 0 0 0.0.0.0:10210 0.0.0.0:* LISTEN 33787/Breezes tcp6 0 0 :::10210 :::* LISTEN 33787/Breezes
http://192.168.62.200:10210/ui/
添加私有仓库
查看镜像
docker run -d --name saltops -v /data/saltops:/data/saltops -p 8002:8001 -p 80:8000 saltops:v2 python3 /data/saltops/manage.py runserver 0.0.0.0:8001
以上是关于Dokcer创建私有仓库私有仓库Web管理的主要内容,如果未能解决你的问题,请参考以下文章