zoukankan      html  css  js  c++  java
  • ubuntu 18.04.5 server 安装部署docker及安装指定版本

    To get started with Docker Engine on Ubuntu, make sure you meet the prerequisites, then install Docker.

    要开始在Ubuntu上使用Docker引擎,请确保满足先决条件,然后安装Docker。

    Prerequisites
    OS requirements
    To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

    先决条件

    操作系统要求

    要安装Docker Engine,您需要这些Ubuntu版本之一的64位版本:

    Ubuntu Groovy 20.10
    Ubuntu Focal 20.04 (LTS)
    Ubuntu Bionic 18.04 (LTS)
    Ubuntu Xenial 16.04 (LTS)
    Docker Engine is supported on x86_64 (or amd64), armhf, and arm64 architectures.

    x86_64(或amd64)、armhf和arm64体系结构支持Docker引擎。

    Uninstall old versions
    Older versions of Docker were called docker, docker.io, or docker-engine. If these are installed, uninstall them:

    卸载旧版本

    Docker的旧版本叫做Docker,码头工人,或docker引擎。如果已安装,请卸载它们:

    安装Docker 引擎

    一、卸载旧版本

    sudo apt-get remove docker docker-engine docker.io containerd runc

    二、设置存储库

    使用存储库安装

    在新主机上首次安装Docker引擎之前,需要设置Docker存储库。之后,您可以从存储库安装和更新Docker。

    设置存储库

    更新apt程序包索引并安装程序包,以允许apt通过HTTPS使用存储库:

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

    三、添加Docker的官方GPG密钥

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

    四、设置指纹

    sudo apt-key fingerprint 0EBFCD88

    五、安装Docker 引擎

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

    六、测试

     sudo docker run hello-world

    七、查看docker版本

    root@yang:~# docker --version
    Docker version 20.10.3, build 48d30b5
    

      

    安装指定版本

    一、查询可安装版本

    要安装特定版本的Docker Engine,请在repo中列出可用版本,然后选择并安装:

    a、 列出您的回购中可用的版本:

    apt-cache madison docker-ce 
     docker-ce | 5:20.10.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:20.10.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:20.10.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:20.10.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.15~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.14~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.13~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.12~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.11~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.10~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.9~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.8~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.7~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.6~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:19.03.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.9~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.8~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.7~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.6~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.5~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.4~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.3~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.2~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.1~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 18.06.3~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 18.06.2~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 18.06.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 18.06.0~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
     docker-ce | 18.03.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
    

    二、安装特定版本

    b、 使用第二列中的版本字符串安装特定版本,例如 5:20.10.3~3-0~ubuntu-bionic。 

    sudo apt-get install docker-ce=5:20.10.3~3-0~ubuntu-bionic docker-ce-cli=5:20.10.3~3-0~ubuntu-bionic containerd.io
    

    卸载docker 引擎

    一、卸载Docker引擎、CLI和Containerd包:

    sudo apt-get purge docker-ce docker-ce-cli containerd.io

    二、删除所有镜像、容器和卷

    主机上的映像、容器、卷或自定义配置文件不会自动删除。要删除所有图像、容器和卷,请执行以下操作:

    sudo rm -rf /var/lib/docker

    必须手动删除任何已编辑的配置文件。

  • 相关阅读:
    [推荐]大量 Blazor 学习资源(二)
    [翻译]欢迎使用C#9.0
    重磅消息:微软发布多平台应用UI框架 MAUI,网友直呼:牛x
    如何对Git的分支进行管理
    如何使用JPA的@Formula注解
    伤其十指,不如断其一指,谈谈我的学习计划
    如何使用Swagger-UI在线生成漂亮的接口文档
    如何在Linux服务器上部署jar包
    使用PageHelper插件分页时,如何对对象进行转换以及添加属性
    在Java中使用Collections.sort 依据多个字段排序
  • 原文地址:https://www.cnblogs.com/yangzp/p/14436240.html
Copyright © 2011-2022 走看看