在Ubuntu中安装Docker,从存储库,找不到存储库

5anewei6  于 2023-02-18  发布在  Docker
关注(0)|答案(3)|浏览(275)

我试着按照官方文档来做。但是,当我运行sudo apt-get install docker-ce docker-ce-cli containerd.io命令时
我收到以下消息:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'

此外,当运行apt-cache madison docker-ce时,终端中没有显示任何内容...

7ivaypg9

7ivaypg91#

1.更新防止酷刑措施:

sudo apt-get update

2.首先安装以下软件包:

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

3.添加GPG密钥:

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

4.然后添加Docker存储库:

echo \
  "deb [arch=$(dpkg --print-architecture) 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

5.再次更新:

sudo apt-get update

6.安装docker-ce、cli和containerd.io:

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

必须工作-确保以root用户身份或使用sudo执行所有命令。
您还可以使用他们的脚本来自动执行所有操作:

curl -fsSL https://get.docker.com -o get-docker.sh
 sudo ./get-docker.sh
b09cbbtk

b09cbbtk2#

use curl https://get.docker.com/ | bash -这是一个自动化脚本,在大多数情况下都可以使用

ppcbkaq5

ppcbkaq53#

安装docker非常简单:

sudo apt install docker.io

相关问题