ubuntu20.4安装docker

前言

ubuntu20.4安装docker官网主要步骤如下:

先删除之前的版本

$ sudo apt-get remove docker docker-engine docker.io containerd runc

使用阿里云源

可以先备份一下,然后编辑,复制阿里源进去,保存!

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

你可能感兴趣的:(ubuntu20.4安装docker)