Docker入门环境安装
环境:mac 10.13.4 , Docker version 18.03.1-ce,Centos7
Docker官网
前言
目前docker提供ce(community edition)社区版本和ee(enterprise edition)企业版本.选择ce版本即可.
Docker下载安装
Centos7安装
1.安装engine版本(有问题弃用)
2.添加docker下载仓库
$ vim /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever
enabled=1
gpgcheck=1
gpgkey=http://yum.dockerproject.org/gpg
$ yum update
$ docker install -y docker-engine
3.启动
$ systemctl start docker
安装CE版本
1.卸载旧版本
$ yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2.安装依赖工具
$ yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
3.安装docker官方仓库(失败 使用阿里云仓库)
$ yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4.如果上面执行后如下报错,添加阿里云的源即可.
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 12] Timeout on https://download.docker.com/linux/centos/docker-ce.repo: (28, 'Resolving timed out after 30455 milliseconds')
上面命令错误时,安装阿里云仓库
$ yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
1.安装docker
$ yum install -y docker-ce
2.启动
$ systemctl start docker
3.添加docker hub加速器
https://www.daocloud.io/mirror.html
$ curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://5c00508c.m.daocloud.io