前言
ubuntu20.4安裝docker官網(wǎng)主要步驟如下:
先刪除之前的版本
$ sudo apt-get remove docker docker-engine docker.io containerd runc
使用阿里云源
可以先備份一下,然后編輯,復(fù)制阿里源進去,保存!
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list
阿里源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
檢查并更新
sudo apt update
sudo apt upgrade
安裝docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
安裝的過程很慢,需要耐心等待一下
安裝完畢
運行docker,開啟
sudo docker run hello-world`
運行helloworld
sudo docker run hello-world