CentOS 7 搭建docker仓库
docker已经足够火了,试想每次部署都要飘洋过海去docker官方仓库拉镜像,肯定受不了,
即使有了国内镜像,然而,频繁的docker部署,依然会让网速捉襟见肘。
所以必须搭建内网私有docker仓库,充分利用高速内网带宽。
与vmware habor相比,docker distrbution 胜在小巧简单。
1、安装dockeryum install docker2、开启docker服务systemctl enable docker systemctl start docker3、获取docker镜像docker pull centos上面是从docker官方仓库获取centos镜像,速度很慢。
也可以从别的地方获取,比如docker pull index.tenxcloud.com/tenxcloud/centos4、安装并启用 docker-distributionyum install docker-distribution systemctl enable docker-distribution systemctl start docker-distribution可以根据需要修改docker-distribution的配置文件 /etc/docker-distribution/registry/config.yml
比如端口(默认5000),镜像存储路径(默认/var/lib/registry)
如果需要监听在80端口,可以用iptables转发实现。iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000
5、查看本地镜像docker images示例输出如下:
# docker images REPOSITORY TAG IMAGE ID CREATED SIZE index.tenxcloud.com/tenxcloud/centos latest 6e7516266d96 9 months ago 309.9 MB
6、给本地docker镜像打标签docker tag 6e7516266d96 localhost:5000/centos:latest7、把镜像发布到仓库中docker push localhost:5000/centos:latest8、删除本地镜像docker rmi index.tenxcloud.com/tenxcloud/centos
docker rmi localhost:5000/centos
docker images9、从仓库中获取镜像docker pull localhost:5000/centos:latest10、查看刚刚本地拉取的镜像docker images
11、修改docker配置文件,默认使用内网仓库
修改文件/etc/sysconfig/docker
#添加内网仓库 ADD_REGISTRY='--add-registry localhost:5000' #禁用官方仓库docker.io(可选) BLOCK_REGISTRY='--block-registry docker.io'
阅读更多
- CentOS环境下Docker私有仓库搭建
- CentOS 7 搭建docker仓库
- Docker系列(四)Centos6.5 搭建私人镜像仓库 v2
- CentOS7搭建Docker私有仓库
- Docker CentOS服务器搭建本地私有仓库
- 详解CentOS 7 : Docker私有仓库搭建和使用
- CentOS 7 : Docker私有仓库搭建和使用
- Centos7上Docker仓库Harbor的搭建
- docker 搭建registry私有仓库 (Centos6.5)
- centos 7.1搭建docker本地私有仓库返回500错误
- Centos 7中Docker私有仓库的搭建方法
- centos7 Docker私有仓库搭建及删除镜像
- centos下搭建docker私有仓库
- Centos上搭建docker的私有仓库
- CentOS 7 : Docker私有仓库搭建和使用
- Docker之Centos7 Docker私有仓库搭建
- 在CentOS 7.2上搭建Docker私有镜像仓库
- Centos 7 docker私有仓库的搭建
- Centos 7 docker私有仓库的搭建
- CentOS 搭建docker私有仓库实践