docker安装

1.运行环境
我用的centos环境,必须是centos7.4以上,否则会出现各种难解的问题

2.移除旧版本docker

$ sudo yum remove docker 
                  docker-client 
                  docker-client-latest 
                  docker-common 
                  docker-latest 
                  docker-latest-logrotate 
                  docker-logrotate 
                  docker-selinux 
                  docker-engine-selinux 
                  docker-engine

3.安装必要的系统工具

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

4.添加软件源信息

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

使用国内阿里云提供的镜像

5.更新yum缓存

sudo yum makecache fast

6.安装docker-ce

sudo yum -y install docker-ce

7.启动docker服务

sudo systemctl start docker

8.测试运行hello world

docker run hello-world

运行结果:

参考文档:
http://www.runoob.com/docker/centos-docker-install.html

原文地址:https://www.cnblogs.com/shijingjing07/p/10523315.html