欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu18安装docker

程序员文章站 2022-04-30 10:36:05
...

环境准备

  1. 首先把源更改为国内源,比如阿里源,清华源等,这一步之前得确保网络已配通,可以看我之前写的网络配置
  2. 先备份  ubuntu18安装docker
  3. 编辑 ubuntu18安装docker
  4. 把原先的源注释掉,加入以下内容,保存退出
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

     依次更新软件源及软件包:sudo apt-get update、sudo apt-get upgrade

Docker安装(参考官网

  • Install packages to allow apt to use a repository over HTTPS:
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
  • Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • Verify that you now have the key with the fingerprint
$ sudo apt-key fingerprint 0EBFCD88
    
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <aaa@qq.com>
sub   rsa4096 2017-02-22 [S]
  • Use the following command to set up the stable repository
$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
  • Update the apt package index
$ sudo apt-get update
  • Install the latest version of Docker Engine - Community and containerd, or go to the next step to install a specific version:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
  • 安装完成,检验是否安装成功:ubuntu18安装docker

配置镜像加速器

  1. 登录阿里云,在镜像搜索那随便输入一个镜像ubuntu18安装docker
  2. 点击“镜像搜索”后来到如下页面ubuntu18安装docker
  3. 点击“镜像加速器”,点击操作文档下的系统,可以看到相应系统的配置信息,我们点击ubuntu即可ubuntu18安装docker
  4. 直接把这一整段代码粘过去运行即可,至此,镜像加速器就配置完成了,之后我们即可通过加速器提升获取Docker官方镜像的速度

    参考文章:https://blog.csdn.net/qq_39506912/article/details/88974664