1、安装docker:我用的是centos7 操作系统 3.10,虽然可以直接yum install docker 但安装的docker1.10 稳定版,生产环境要用1.12的所以需要配置下yum源。
操作步骤:
1、 配置yum源
?
1
2
3
4
5
6
7
8 |
touch /etc/yum .repos.d /docker .repo
输入如下
[dockerrepo]
name=Docker Repository
baseurl=https: //yum .dockerproject.org /repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https: //yum .dockerproject.org /gpg |
2、确保之前没有docker相关安装包:
?
1
2 |
rpm -qa | grep docker
yum -y remove xxx |
3、安装docker
?
1
2 |
yum install libdevmapper* -y
yum install docker-engine -y |
4、启动docker
?
1
2 |
systemctl start docker.service
chkconfig docker on |
5、设置docker 镜像源加速器
复制代码 代码如下:
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://48b042ae.m.daocloud.io
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://48b042ae.m.daocloud.io
注:初次会生成/etc/docker/daemon.json 文件,并写入{"registry-mirrors": ["http://48b042ae.m.daocloud.io"]}
配置参数。
?
1
2 |
[root@dockerNode1 ~] # cat /etc/docker/daemon.json
{ "registry-mirrors" : [<a href= "http://48b042ae.m.daocloud.io/" >http: //48b042ae .m.daocloud.io< /a >]} |
6、下载registry镜像
?
1 |
docker pull registry |
7、启动registry容器
?
1 |
docker run -d -p 5000:5000 - v /opt/data/registry : /tmp/registry registry |
7.1配置本地deamon.json文件
添加如下参数:"insecure-registries":["172.19.136.238:5000"]
该参数解决了 http: server gave HTTP response to HTTPS client问题
8、官网拉取测试镜像
?
1 |
docker pull busybox |
9、测试镜像打标签
?
1 |
docker tag busybox 172.19.136.238:5000 /gongtest :01 注库名不能有大写字母 |
10、上传到本地仓库
?
1 |
docker push 172.19.136.238:5000 /gongtest :01 |
11、删除本地镜像
?
1 |
docker rmi 172.19.136.238:5000 /gongtest :01 |
12、通过http api访问下
?
1
2
3
4 |
[root@dockerNode1 ~] # curl 172.19.136.238:5000/v2/_catalog
{ "repositories" :[ "gongtest" ]}
[root@dockerNode1 ~] # curl 172.19.136.238:5000/v2/gongtest/tags/list
{ "name" : "gongtest" , "tags" :[ "01" ]} |
13、拉取本地仓库镜像(如果其它节点需要安装docker情况下进行7.1配置)
?
1 |
docker pull 172.19.136.238:5000 /gongtest :01 |
14、验证是否下载:
?
1
2
3
4 |
[root@dockerNode1 ~] # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
172.19.136.238:5000 /busybox latest 8a4698b1752b Less than a second ago 1.11 MB
172.19.136.238:5000 /gongtest 01 8a4698b1752b Less than a second ago 1.11 MB |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持快网idc。
原文链接:http://blog.csdn.net/kadiya2011/article/details/54348037
相关文章
猜你喜欢
- 服务器技术之硬件冗余技术 2025-05-27
- 服务器是租用还是服务器托管好? 2025-05-27
- 什么是DNS以及它如何影响服务器? 2025-05-27
- 刀片服务器与机架服务器的区别介绍 2025-05-27
- 服务器虚拟化技术深度科普 2025-05-27
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-27 58
-
2025-05-27 49
-
2025-05-27 56
-
2025-05-27 109
-
2025-05-26 81
热门评论