树莓派 Ubuntu20.04 安装 Docker

up-da4bd00ea1487d99e7345bdba8d013f5c62.png

卸载旧版本

旧版本的 Docker 被称为 docker、docker.io 或 docker-engine。如果安装了这些,请卸载它们:

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

设置存储库

1、更新 apt 包索引并安装包以允许 apt 通过 HTTPS 使用存储库

sudo apt-get update
sudo apt-get install \
   apt-transport-https \
   ca-certificates \
   curl \
   gnupg \
   lsb-release

2、 添加Docker官方的GPG密钥:

 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

3、使用以下命令设置稳定存储库。要添加 nightly 或 test 存储库,请在以下命令中的 stable 一词后添加 nightly 或 test (或两者)一词。

 echo \
  "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

安装 Docker 引擎

1、更新apt包索引,并安装最新版本的Docker Engine和containerd,或者到下一步安装特定版本:

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

2、 要安装特定版本的 Docker Engine,请在 repo 中列出可用版本,然后选择并安装:

①列出您的存储库中可用的版本:

apt-cache madison docker-ce

up-74498631247d16eb8163e4e39d68ea31e51.png

使用第二列中的版本字符串安装特定版本,例如  5:20.10.7~3-0~ubuntu-groovy

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

3、 通过运行 hello-world 镜像验证 Docker Engine 是否已正确安装

sudo docker run hello-world

此命令下载测试映像并在容器中运行它。当容器运行时,它会打印一条信息性消息并退出。

 

升级 Docker 引擎

要升级 Docker 引擎,请先运行 sudo apt-get update,然后按照安装说明选择要安装的新版本

参考

https://docs.docker.com/engine/install/ubuntu/

おすすめ

転載: blog.csdn.net/qq_25231683/article/details/120016952