【问题标题】:Installing Docker in Ubuntu, from repo. Can't find a repoInstalling Docker in Ubuntu, from repo. Can't find a repo
【发布时间】:2023-02-17 20:42:58
【问题描述】:

我正在尝试关注official documentation。 但是,当我运行命令 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时,终端中没有任何显示...

【问题讨论】:

    标签: docker ubuntu-20.04


    【解决方案1】:

    1.更新APT:

    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
    

    【讨论】:

    • 谢谢...我唯一没有尝试过的是第 5 步。所有其他的都按照您展示的那样完成。最后,在阅读您的答案之前,我设法通过包安装。不确定我将来是否会遇到问题。
    • 手动安装包含在脚本中(get.docker.com)。你可以在那里看到这么多代码,因为这些代码支持所有的 linux 发行版。手动安装或自动安装,效果相同...很高兴我能提供帮助:)
    【解决方案2】:

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

    【讨论】:

    • 感谢你的回答。最后,在阅读您的答案之前,我通过 package. ;)
    【解决方案3】:

    安装docker 非常简单:

    sudo apt install docker.io
    

    【讨论】:

      猜你喜欢
      • 2022-12-01
      • 2016-12-04
      • 1970-01-01
      • 2022-12-02
      • 2022-10-25
      • 1970-01-01
      • 2022-12-02
      • 1970-01-01
      • 2023-03-19
      相关资源
      最近更新 更多