Centos7 安装Docker
-
操作系统条件:64位CentOS 7
-
卸载旧版本的docker相关包
$ sudo yum remove docker \
docker-common \
container-selinux \
docker-selinux \
docker-enginesudo yum remove docker \
docker-common \
container-selinux \
docker-selinux \
docker-engine
- 安装必备包
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
- 设置稳定的仓库
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
- 更新源指引
$ sudo yum makecache fast
- 安装最新版的Docker
$ sudo yum install docker-ce
- 编辑/etc/docker/daemon.json文件,如果不存在,手动创建;然后添加以下内容
{
"storage-driver": "devicemapper"
}
- 启动Docker
$ sudo systemctl start docker
- 通过运行hello-world镜像,验证Docker是否正常安装,
$ sudo docker run hello-world
~~~~~~~~~~~~~~~~~~~~~~~~~~闲谈莫论人非,静坐常思己过~~~~~~~~~~~~~~~~~~~~~~~~~~