1、系统环境

CentOS7.3

Docker需要安装在64为平台上,并且内核版本不能低于3.10

[[email protected] ~]# uname -a
Linux web-t 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

2、Docker安装

Docker官方提供了安装脚本,可以直接使用

curl -sSL https://get.docker.com/ | sh

执行完成后,安装完毕。

但是用这个脚本安装的过程比较缓慢,建议使用国内的Docker镜像源进行安装

阿里云的安装脚本

curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

DaoCloud的安装脚本

curl -sSL https://get.daocloud.io/docker | sh

3、镜像加速器

Docker安装完毕后,默认使用Docker Hub作为镜像源,国内访问时比较慢,而且经常报错,使用过程中出现过如下错误

[[email protected] html]# docker pull nginx
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 172.30.0.18:53: too many redirects

网上给了很多建议,但我尝试更换了一下DNS为114.114.114.114或者8.8.8.8,报错就消失了,应该是使用本地的DNS解析返回的地址使用用户比较多,访问请求被拒绝了。

更换为阿里的镜像加速器

进入阿里云docker库

https://dev.aliyun.com

注册登录后,点击右上角 管理中心

进入控制台后,点击左侧 Docker Hub镜像站点获取加速器地址

Docker学习笔记——Docker安装部署

按照提示修改daemon配置文件,并重启docker服务


配置完毕,来获取一个mongo镜像

[[email protected] ~]# docker pull mongo
Using default tag: latest
latest: Pulling from library/mongo
5233d9aed181: Pull complete 
5bbfc055e8fb: Pull complete 
aaf85a329dc4: Pull complete 
1360aef7d266: Pull complete 
9cb9d47c5d80: Pull complete 
80e12bf92c3c: Pull complete 
56b002b43f9a: Pull complete 
741d63bb9470: Pull complete 
c5b08545788b: Pull complete 
b51d4f928b3c: Pull complete 
e8c075c543c2: Pull complete 
Digest: sha256:127c37fd3713a87a24c9b9fdc87f215dccfd5fefb11d5765a3e3bee34431d67f
Status: Downloaded newer p_w_picpath for mongo:latest


 知行办公,专业移动办公平台
【总监】十二春秋之,[email protected]
【Master】zelo,[email protected]
【运营】运维艄公[email protected]
【产品设计】流浪猫,[email protected]
【体验设计】兜兜,[email protected]
【iOS】淘码小工,[email protected];iMcG33K,[email protected]
【Android】人猿居士,[email protected];思路的顿悟,[email protected]
【java】首席工程师MR_W,[email protected]
【测试】土镜问道,[email protected]
【数据】喜乐多,[email protected]
【安全】保密,你懂的。