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

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/lyl0724/article/details/88050560

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

猜你喜欢

转载自blog.csdn.net/lyl0724/article/details/88050560