Docker安装

Centos

  • 清除旧环境
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine -y
  • 安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
  • 安装软件源
yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
  • yum缓存
yum makecache
  • 安装docker-ce和docker-compose
yum install docker-ce docker-compose -y
  • 启动服务
systemctl start docker
systemctl enable docker

Ubuntu

  • 移除旧的
apt-get remove docker docker-engine docker.io -y
  • 更新并安装依赖
apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common -y
  • 添加软件源密钥
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | apt-key add -
  • 添加软件源
add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  • 更新并安装
apt-get update && apt-get install docker-ce docker-compose -y
  • 启动服务
systemctl start docker
systemctl enable docker
posted @ 2019-08-14 18:40  lrxcywq  阅读(130)  评论(0编辑  收藏  举报