How to install Docker manually?

Reason for writing: Many friends currently encounter problems of one kind or another when installing Docker, resulting in failure to install Docker and unable to experience the joy of silky-smooth docker containers. I hereby write a manual installation tutorial for docker, covering Ubuntu. , Debian, CentOS, RedHat mainstream operating systems

Ubuntu/Debian

1. Delete the previously installed docker

apt-get remove docker docker-engine docker.io

2. Install dependencies

apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

3. Add trusted dependencies (debian)

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Ubuntu:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4. Add software repository (debian)

add-apt-repository \

   "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \

   $(lsb_release -cs) \

   stable"

Ubuntu:

add-apt-repository \

   "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \

   $(lsb_release -cs) \

   stable"

5. Installation

apt-get update

apt-get install docker-ce

CentOS/RedHat

1. Delete the previously installed docker

yum remove docker docker-common docker-selinux docker-engine

2. Install some dependencies

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

3. Configure the docker installation source

wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo

4. Replace the installation source with Tsinghua source

sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo

5. Installation

yum makecache fast

yum install docker-ce

Guess you like

Origin blog.csdn.net/u011630259/article/details/124533056