【原】Docker入门之Centos7.0+安装

  服务器配置:1核2G 40G 硬盘,Centos 7.4。

   以下全程是在 root 用户下操作:

  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.使用以下命令设置稳定的存储库
yum-config-manager --add-repo
    https://download.docker.com/linux/centos/docker-ce.repo


4.更新 yum 缓存
yum makecache fast
5.安装 Docker-ce:
yum -y install docker-ce
6.Docker 后台服务
systemctl start docker
7.测试运行 hello-world

docker run hello-world

镜像加速:

  鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,在这里采用阿里云的镜像:

  1. 登录阿里云开发网站(https://dev.aliyun.com/search.html)
  2. 打开 -----》https://cr.console.aliyun.com/cn-shenzhen/mirrors
  3. 如下蓝色框所示,复制到本地的一个文本,后续会用上。

 切换回Linux控制台,输入: vim /etc/docker/daemon.json ,在这个json文件里写入刚才保存的地址,保存后退出!

 { "registry-mirrors": ["http://hub-mirror.c.163.com"] }

           

  

 
 

  

 
 
原文地址:https://www.cnblogs.com/zdd-java/p/9936069.html