您的位置:首页 > 运维架构 > Docker

Docker私服Registry搭建

2014-05-19 19:25 513 查看




Docker私服Registry搭建

本文基于docker 1.x,registry 0.7.3

搭建过程主要有:

创建私服镜像Registry
关联本地磁盘和Registry container
启动Registry container


创建私服镜像

docker build -t registry https://git.oschina.net/feedao/Docker_shell/raw/start/Dockerfile-registry


其实也可以直接docker pull registry的


启动,并关联本地磁盘

为了防止重启container,造成私服镜像丢失,我们要和本地磁盘关联,进行持久化。

本地创建私服镜像目录:
mkdir /opt/docker-image/registry
# 可选mkdir /opt/docker-image/registry-config


可选

本地添加配置文件 /opt/docker-image/registry-config/config.yml
dev:
loglevel: info
storage: local
storage_path: /opt/registry


通过
-v /opt/docker-image
命令将本地的目录
/opt/docker-image
绑定到container的
/opt
目录。并通过
-e
DOCKER_REGISTRY_CONFIG=/opt/registry-config/config.yml
设置container的环境变量。如果不设置,则默认使用config_sample.yml
docker run \
-d -p 0.0.0.0:33307:22 \
-p 0.0.0.0:5000:5000 \
-v /opt/docker-image:/opt/docker-image \
-e SQLALCHEMY_INDEX_DATABASE:sqlite:////opt/docker-image/docker-registry.db \
-e STORAGE_PATH=/opt/docker-image \
registry


如何搜索私服上的镜像

curl -XGET http://registry:5000/v1/search?q=镜像名称[/code] 
https://github.com/dotcloud/docker-registry

上最新添加了这个功能

更详细的看:http://stackoverflow.com/questions/23733678/how-to-search-images-from-private-registry-in-docker


Reference

/article/10662385.html

/content/1352264.html

更仔细的细读官方的吧:https://github.com/dotcloud/docker-registry
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: