docker安装教程
1.环境
centos 7.0
2.docker 安装
a)安装依赖包:
` yum install -y yum-utils device-mapper-persistent-data lvm2`
b)为yum添加docker-ce的稳定仓库:
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
c) 更新yum包索引:yum makecache fast
d) 安装docker:yum install docker-ce
e) 启动docker: systemctl start docker
3.检查docker是否启动成功:docker --version
4.安装docker-compose
a)安装docker-compose的依赖:
i. `yum install epel-release`
ii. `yum install -y python-pip`
b)安装docker-compose : `pip install docker-compose`
如果出现No module named 'pip._internal.cli.main'
`sudo easy_install pip` 解决
c)更新yam的python包:yum upgrade python*
docker 设置国内镜像源
这个太重要了
创建或修改 /etc/docker/daemon.json 文件,修改为如下形式
# vi /etc/docker/daemon.json
{
"registry-mirrors" : [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
]
}
重启docker服务使配置生效
$ systemctl restart docker.service