sudo apt update 在 GCP Compute Engine VM 上出现 404

sudo apt update 在 GCP Compute Engine VM 上出现 404

我正在 GCP Compute Engine VM 中安装 Docker,但遇到了一些障碍。

这是我第一次这样做,有人可以帮忙吗?

fdtigermaster@fdtigermaster-dev-gcp-test:~$ sudo apt-get update

Hit:1 http://us-central1.gce.archive.ubuntu.com/ubuntu mantic InRelease  
Hit:2 http://us-central1.gce.archive.ubuntu.com/ubuntu mantic-updates InRelease                         
Hit:3 http://us-central1.gce.archive.ubuntu.com/ubuntu mantic-backports InRelease                       
Hit:4 http://security.ubuntu.com/ubuntu mantic-security InRelease                                       
Ign:5 https://download.docker.com/linux/debian mantic InRelease                                        
Hit:6 https://download.docker.com/linux/ubuntu mantic InRelease  
Err:7 https://download.docker.com/linux/debian mantic Release              
       404  Not Found [IP: 13.226.22.98 443]        
         Reading package lists... Done          
E: The repository 'https://download.docker.com/linux/debian mantic Release' does not have a Release file.   
N: Updating from such a repository can't be done securely, and is therefore disabled by default.   
N: See apt-secure(8) manpage for repository creation and user configuration details.

我也尝试过:

sudo sed -i 's/debian/ubuntu/g' /etc/apt/sources.list.d/docker.list
sudo sed -i 's|docker.com/linux/debian|docker.com/linux/ubuntu|g' /etc/apt/sources.list

答案1

检查您的/ect/apt/sources.list目录和目录下的文件/etc/apt/sources.list.d,然后删除任何相关的docker源。

遵循官方文档:设置 Docker 的 apt 存储库。

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

答案2

打开终端并备份您的存储库列表。
cd /etc/apt
sudo nano sources.list这样您就可以看到其中的内容。
sudo cp sources.list sources.list.backup
然后使用此方法重置
sudo apt-get install ppa-purge
并报告。

相关内容