• 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
    

      

  • 相关阅读:
    【Tomcat】export: `xxx': 不是有效的标识符
    【Linux】查看程序是否正常运行
    【Linux】bat文件如何执行
    【oracle】截取字符串
    【java异常】Expected one result (or null) to be returned by selectOne(), but found: 63
    【java异常】定时任务异常ERROR 20604 --- [ scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task
    【oracle】ORA-12638
    【java异常】Unable to install breakpoint in
    【oracle】处理锁表
    20180318 代码错题(4)
  • 原文地址:https://www.cnblogs.com/Nick-Hu/p/13264524.html
Copyright © 2020-2023  润新知