步骤如下

更新 apt-get 源

sudo apt-get update

安装包允许 apt-get 通过 https 使用仓库

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

添加 docker 官方 GPG key

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

设置 docker 稳定版仓库

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

设置完毕仓库,重新更新源

sudo apt-get update

更新上面的源时,可能会出现如下错误

获取:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
忽略:2 https://download.docker.com/linux/ubuntu focal InRelease
错误:3 https://download.docker.com/linux/ubuntu focal Release
404 Not Found [IP: 13.225.103.65 443]
命中:4 http://mirrors.163.com/ubuntu focal InRelease
命中:5 http://mirrors.163.com/ubuntu focal-updates InRelease
命中:6 http://mirrors.163.com/ubuntu focal-backports InRelease
忽略:7 http://dl.google.com/linux/chrome/deb stable InRelease
命中:8 http://dl.google.com/linux/chrome/deb stable Release
命中:9 http://archive.ubuntukylin.com:10006/ubuntukylin trusty InRelease
正在读取软件包列表... 完成
E: 仓库 “https://download.docker.com/linux/ubuntu focal Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

处理方法

在 /etc/apt/source.list 文件中增加如下配置

deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

再次更新源

sudo apt-get update

可能会出现如下错误

获取:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
获取:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
命中:3 http://mirrors.163.com/ubuntu focal InRelease
命中:4 http://mirrors.163.com/ubuntu focal-updates InRelease
命中:5 http://mirrors.163.com/ubuntu focal-backports InRelease
忽略:6 http://dl.google.com/linux/chrome/deb stable InRelease
命中:7 http://dl.google.com/linux/chrome/deb stable Release
命中:8 http://archive.ubuntukylin.com:10006/ubuntukylin trusty InRelease
忽略:10 https://download.docker.com/linux/ubuntu focal InRelease
获取:11 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [11.0 kB]
错误:12 https://download.docker.com/linux/ubuntu focal Release
404 Not Found [IP: 13.225.103.32 443]
正在读取软件包列表... 完成
E: 仓库 “https://download.docker.com/linux/ubuntu focal Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

可以看到的是,上面的 11 已经是成功的,12 是错误的,这个时候,我们只需要其 /etc/apt/source.list 中删除掉报错对应的内容

再次更新源

sudo apt-get update

安装最新的 docker-ce

sudo apt-get install docker-ce

避免每次使用 docker 命令都需要加上 sudo

sudo usermod -a -G docker $USER
or
sudo usermod -aG docker $USER

重启系统

在 ubuntu20 上安装 docker的更多相关文章

  1. Centos7上安装docker (转)

    Centos7上安装docker Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE. 社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如 ...

  2. 简单介绍一下在CentOS上安装Docker。

    简单介绍一下在CentOS上安装Docker. 前置条件: 64-bit 系统 kernel 3.10+ 1.检查内核版本,返回的值大于3.10即可. $ uname -r 2.使用 sudo 或 r ...

  3. linux上安装Docker(非常简单的安装方法)

    Docker的三大核心概念:镜像.容器.仓库 镜像:类似虚拟机的镜像.用俗话说就是安装文件. 容器:类似一个轻量级的沙箱,容器是从镜像创建应用运行实例, 可以将其启动.开始.停止.删除.而这些容器都是 ...

  4. debian上安装docker ce

    在Debian9上安装Docker CE 使用从包中安装的方式 Docker是一个开源的容器引擎,它有助于更快地交付产品.Docker可将应用程序和基础设施层隔离,并且将基础设施当作程序一样进行管理. ...

  5. Windows 上安装docker

    Windows 上安装docker //(第一种)下载boot2docker https://github.com/boot2docker/windows-installer/releases //( ...

  6. 在 Mac OS X 上安装 Docker(转)

    http://www.oschina.net/translate/installing-docker-on-mac-os-x?print 在 Mac OS X 上安装 Docker 注意:Docker ...

  7. 在Ubuntu16.04.4上安装docker

    在Ubuntu16.04.4上安装docker 一.环境准备     首先我们需要一台Ubuntu16.04 虚拟机或者真机,其次,我们对其进行环境配置.       1.1.移除已经安装过的dock ...

  8. 002-docker安装-mac上安装docker,17.06在CentOS7 64位机器上安装

    一.mac上安装docker 1.下载 通过这个链接下载:https://download.docker.com/mac/stable/Docker.dmg 2.安装 将 Moby 的鲸鱼图标拖拽到  ...

  9. 在Centos 7上安装Docker

    在Centos 7上安装Docker 1.docker介绍 docker是类似于vmware的虚拟化软件,可以开发.容纳.运行应用程序的平台,在容器中安全的隔离运行应用程序. 2.Docker引擎 D ...

随机推荐

  1. Bitmap之位图采样和内存计算详解

    原文首发于微信公众号:躬行之(jzman-blog) Android 开发中经常考虑的一个问题就是 OOM(Out Of Memory),也就是内存溢出,一方面大量加载图片时有可能出现 OOM, 通过 ...

  2. eclipse报错:problems during content assist

    自动提示出错: 解决办法:Windows->preferences->java->editor->content assist->advanced 取消java prop ...

  3. PTA数据结构与算法题目集(中文) 7-26

    PTA数据结构与算法题目集(中文)  7-26 7-26 Windows消息队列 (25 分)   消息队列是Windows系统的基础.对于每个进程,系统维护一个消息队列.如果在进程中有特定事件发生, ...

  4. 【C++】VS2017 不能将const char * 分配给 char *

    我的方式是把结构体中定义的 char * 换成string #include <iostream> #include<string> using namespace std; ...

  5. 微信小程序wx.setStorage(OBJECT)

    关于微信小程序的:wx.setStorage(OBJECT)在官网API介绍到:

  6. Javascript 入门 document

    JS可以在hmtl中直接插入文本. <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...

  7. Pod容器共享Volume

    同一个Pod中的多个容器能够共享Pod级别的存储卷Volume.Volume可以被定义为各种类型,多个容器各自进行挂载操作,将一个Volume挂载为容器内部需要的目录,如图 在下面的例子中,在Pod内 ...

  8. [译]HAL-超文本应用语言

    [译]HAL-超文本应用语言 精益超媒体类型 总结 HAL 是一种简单的格式,它提供了一种一致且简便的方法在 API 的资源之间进行超链接. 采用 HAL 将使您的 API 易于探索,并且其文档很容易 ...

  9. webWMS开发过程记录(四)- 整体设计

    分层 View(Servlet/Action/JSP)--> Service(接口/实现类) --> Dao(接口/实现类) 所用技术 Struts2 Hibernate Spring J ...

  10. 分布式 and 集群

    集群是个物理形态,强调个体和群体之间的联系: 同一个业务部署在多个服务器上,形成的逻辑上的整体. 分布式是个工作方式.强调请求和处理直接的分发状况: 一个业务分拆多个子业务,部署在不同的服务器上,通过 ...