docker install the latest version

For all kinds of questions, we often look for answers through search engines first. For example: docker unbunt installation. Then use it. But IT technology is changing with each passing day, and various answers online may be outdated. Such as installing docker.

The best way is to go directly to the docker official website to see the instructions. The following is obtained from the official website

 

cents 7

 

#!/usr/bin/env bash
sudo yum remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine
sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

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

systemctl enable docker
sudo systemctl start docker

#install docker-compose
#Download directly from github, blocked by the wall
#curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
#chmod +x /usr/local/bin/docker-compose
#install with pip
sudo yum -y install python-pip
sudo pip install --upgrade pip
sudo pip install docker-compose

 The above is to install the latest, if you want to specify the version

 

#Check the version first
yum list docker-ce --showduplicates

#Install the specified version
yum install docker-ce-<version>
 

 

Ubuntu 16

 

#!/usr/bin/env bash
sudo apt-get remove docker docker-engine docker.io
 sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

#Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

#set up the stable repository.
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

#docker
sudo apt-get update
sudo apt-get install docker-ce
 The above is to install the latest, if you want to specify the version

 

 

#Check the version first
apt-cache madison docker-ce

#Install the specified version
sudo apt-get install docker-ce=<版本>
 

 

 

If you find that this script does not work, please go to the docker official website

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326640965&siteId=291194637