zoukankan      html  css  js  c++  java
  • 1.【原创】Ubuntu下Docker的安装&设置开机启动

    根据官方文档进行docker安装(文档地址:https://docs.docker.com/engine/install/ubuntu/):

    1.安装前提条件:

    必须要在64位的系统下才能安装,当前版本的docker是不支持32位系统的。
    发行的版本号如下,16.04之前的版本建议进行升级:
    Ubuntu Focal 20.04 (LTS)
    Ubuntu Eoan 19.10
    Ubuntu Bionic 18.04 (LTS)
    Ubuntu Xenial 16.04 (LTS)
    

      

    2.卸载老版本的docker(如果你有安装的话)我这里是因为没有安装docker所以提示不存在:

    root@ubuntu-xenial:/etc/apt# sudo apt-get remove docker docker-engine docker.io containerd runc
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package 'docker' is not installed, so not removed
    Package 'docker-engine' is not installed, so not removed
    Package 'docker.io' is not installed, so not removed
    Note, selecting 'containerd.io' instead of 'containerd'
    Note, selecting 'containerd.io' instead of 'runc'
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    

      

    3.docker存储驱动说明:

      docker存储驱动支持overlay2(默认)aufs 和btrfs这三种,如果要切换存储驱动可以参照文档(地址:https://docs.docker.com/storage/storagedriver/aufs-driver/):

    4.安装方式:docker是支持如下三种安装方式的,各有利弊,这篇博文我将采用第一种方式:

    1.大多数用户采用设置 Docker 的存储库这种方式安装,有点在于可定制化的安装参数。这是官方推荐的方法。
    
    2.使用 DEB 包并手动安装,这种情况适合没有网络的情况下。
    
    3.在测试和开发环境中,一些用户选择使用自动化脚本来安装 Docker,这种有点在于方便快速,但是安装参数都是固定的,不够灵活。
    

      

    5.设置存储仓库:

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

    6.配置docker安装的地址信息(不同平台的下载地址会有所不同):

    #x86_64平台和amd64平台(官方)
    sudo add-apt-repository 
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu 
       $(lsb_release -cs) 
       stable"
    
    #x86_64平台和amd64平台(阿里镜像:国内建议使用,速度快很多)
    sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
    

      

    7.安装docker:

    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    

      

    8.启动docker,查看镜像仓库验证是否启动成功:

    root@ubuntu-xenial:/# sudo systemctl start docker
    root@ubuntu-xenial:/# docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    

      

     9.将docker设置为开机自启动:

    sudo systemctl enable docker
    

      

  • 相关阅读:
    蓝牙接收苹果手机通知 ANCS协议分析
    sqlite索引的原理
    iOS 项目的编译速度提高
    苹果核
    如何将 iOS 工程打包速度提升十倍以上
    微信跳一跳 (亲测可用)
    iOS 11 适配集锦
    iOS端Mock GPS定位 —— 测试、开发、玩游戏、发朋友圈等等,你都用得上(转)
    架构、框架、模式、模块、组件、插件、控件、中间件的含义和区别
    OC基础--对象做参数在方法间传递
  • 原文地址:https://www.cnblogs.com/Nick-Hu/p/13264524.html
Copyright © 2011-2022 走看看