Loading

ubuntu安装docker-ce 、docker-ce-cli、containerd.io

问题

ubuntu安装docker的时候特别慢,百度搜了一大堆都没讲到点子上,最后请教了大佬才知道是的问题

安装

  • 修改源
    sudo gedit /etc/apt/sources.list

  • 添加源

  • 阿里源:

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-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports 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-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
  • 中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
  • 检查并更新
    sudo apt update
    sudo apt upgrade

接着安装
sudo apt-get install docker-ce docker-ce-cli containerd.io
安装的过程还是很慢,简直慢的令人发指。不能忍!

这里还很奇怪,我上面明明换了清华源,但是这里apt安装docker-ce的时,使用的还是doker的官方源,看来上面的换源没有起作用!

  • 解决方法

    • sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
    • curl -fsSL https://mirrors.nwafu.edu.cn/docker-ce/linux/ubuntu/gpg | apt-key add - # 这里使用
    • sudo add-apt-repository "deb [arch=amd64] https://mirrors.nwafu.edu.cn/docker-ce/linux/ubuntu/ $(lsb_release -cs) stable"
    • sudo apt-get update

芜湖!速度直接起飞~

安装完毕

配置

  • 运行docker
    sudo docker run hello-world

这里运行的时候报错

latest: Pulling from library/hello-world
docker: Get https://registry-1.docker.io/v2/library/hello-world/manifests/sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042: net/http: TLS handshake timeout.
See 'docker run --help'.

解决方法
service docker start #开启一下docker
再次运行 sudo docker run hello-world

参考:
https://blog.csdn.net/qq_19307465/article/details/84453901

posted @ 2020-06-13 14:59  Unixcs  阅读(10731)  评论(0编辑  收藏  举报