Ubuntu20.04安装Docker详细步骤

0.前言

ubuntu版本:20.04
阿里巴巴开源镜像网站:https://developer.aliyun.com/mirror/

1.Ubuntu安装Docker步骤

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

sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

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

 //通过搜索指纹的后8个字符,验证现在是否拥有带有指纹的密钥 
sudo apt-key fingerprint 0EBFCD88

 //结果:
 pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
 uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
 sub   rsa4096 2017-02-22 [S]
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

//更新apt程序包索引,并安装最新版本的Docker Engine和容器
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

6、通过运行hello-world 映像来验证是否正确安装了Docker Engine

sudo docker run hello-world

结果:Hello from Docker!如下图

参考文档:https://blog.csdn.net/qq_36335426/article/details/111308213