docker在线离线安装的几种方法

docker安装方法

在centos7中安装docker环境

docker-ce官网安装教程:https://docs.docker.com/install/linux/docker-ce/centos/

第一种、配置yum源在线安装

1、如果有旧的版本docker,需要先卸载

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-utils 等组件

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

3、添加yum源

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

4、安装docker-ce

yum install docker-ce

第二种、在线脚本安装

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker your-user
# 启动docker并设置开机启动
systemctl start docker
systemctl enable docker

第三种、离线安装

离线安装,下载docker包,这种方法最快最省事,比较奇葩

下载地址:https://download.docker.com/linux/static/stable/x86_64/

官方文档:https://docs.docker.com/install/linux/docker-ce/binaries/

官网说明:
Download the static binary archive. Go to https://download.docker.com/linux/static/stable/ (or change stable to edge or test), choose your hardware platform, and download the .tgz file relating to the version of Docker CE you want to install.

tar xzvf /path/to/<FILE>.tgz
sudo cp docker/* /usr/bin/
sudo dockerd &

卸载docker

sudo yum remove docker-ce
sudo rm -rf /var/lib/docker
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值