便民 发表于 2019-2-15 15:28:07

docker(centos7)纯命令安装贴

  1. 安装依赖包
  yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
  
  2. 配置镜像源(使用中科大镜像站)
  切换到repo目录:
  cd /etc/yum.repo.d/
  添加证书:
  wget http://mirrors.ustc.edu.cn/docker-ce/linux/centos/gpg
  rpm --import gpg
  下载docker-repo:
  wget http://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
  替换官方地址(编辑模式):
  vim docker-ce.repo
  % s:download.docker.com:mirrors.ustc.edu.cn\/docker-ce:g
  3. 更新缓存,安装docker
  yum makecache
  yum install docker-ce -y
  
  4. 设置开机启动
  systemctl enable docker
  systemctl start docker
  
  5.配置docker镜像加速器(可以申请阿里云的专属加速器,位置:容器镜像服务)
  vim /etc/docker/daemon.json
  {
  "registry-mirrors": [
  "https://registry.docker-cn.com"
  ]
  }
  
  systemctl daemon-reload
  systemctl restart docker
  6.开启你的hello-world!
  docker run hello-world
  6.基本完成,主要目的是记录,方便粘贴复制。下一步计划做一个脚本,坐等更新。



页: [1]
查看完整版本: docker(centos7)纯命令安装贴