• Install Docker Engine on CentOS


    Install Docker Engine on CentOS

    是2020年4月25日做的这件事, 至少当学英语了吧.

    环境: 阿里云服务器

    官网文档

    Estimated reading time:* 10 minutes

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

    开始安装之前, 确保先读读Prerequiresites4

    1 Prerequiresites

    1.1 OS requirements

    To install Docker Engine, you need a maintained version of CentOS 7. Archived versions aren’t supported or tested.

    The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.

    The overlay2 storage driver is recommended.

    你应该有一个维护版本为7的CentOS系统. 归档的老旧的版本不被支持或拿来测试. 需要确保系统的附加设备仓库可用, 必须的.

    extras - 附加设备

    maintained version - 维护版本

    1.2 Uninstall old versions

    Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.

    新老版本名字不同, 要先删掉老版本.

    $ sudo yum remove docker 
                      docker-client 
                      docker-client-latest 
                      docker-common 
                      docker-latest 
                      docker-latest-logrotate 
                      docker-logrotate 
                      docker-engine
    

    It’s OK if yum reports that none of these packages are installed.

    The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. The Docker Engine package is now called docker-ce.

    这个路径下的内容, 包括...被保留下来了

    现在引擎已经改名docker ce了, 别认错咯

    2 Installation methods

    2.1 Install using the repository

    Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

    第一次在一个新主机机器上安装, 要先安装Docker repository. 之后你可以安装或更新Docker, 从这个repo

    SET UP THE REPOSITORY

    Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.

    安装yum-utils包, 它提供了yum-配置管理工具, 然后安装稳定repo

    $ sudo yum install -y yum-utils
    
    $ sudo yum-config-manager 
        --add-repo 
        https://download.docker.com/linux/centos/docker-ce.repo
    

    都成功了

    Optional: Enable the nightly or test repositories.

    These repositories are included in the docker.repo file above but are disabled by default. You can enable them alongside the stable repository. The following command enables the nightly repository.

    $ sudo yum-config-manager --enable docker-ce-nightly
    

    To enable the test channel, run the following command:

    $ sudo yum-config-manager --enable docker-ce-test
    

    You can disable the nightly or test repository by running the yum-config-manager command with the --disable flag. To re-enable it, use the --enable flag. The following command disables the nightly repository.

    $ sudo yum-config-manager --disable docker-ce-nightly
    

    Learn about nightly and test channels.

    提供了其他可选项, 节约时间, 不搞这个了.

    Install Docker Engine

    主菜来了

    1. Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

      安装最新版引擎和容器, 或者去next step 安装指定版本. 不要怂, 当然最新版.

      $ sudo yum install docker-ce docker-ce-cli containerd.io
      

      Complete! 喜闻乐见

      If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.

      GPG?

      GNU隐私卫士GPG, GNU Privacy Guard)部分展示如何实现基于公开密钥和私有密钥的加密机制.

      Got multiple Docker repositories?

      If you have multiple Docker repositories enabled, installing or updating without specifying a version in the yum installor yum update command always installs the highest possible version, which may not be appropriate for your stability needs.

      multiple - 许多 多重

      Docker is installed but not started. The docker group is created, but no users are added to the group.

      安装完成, 但没启动. docker group 已经创建, 但是没有users被添加进来呢.

    2. To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

      a. List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:

      $ yum list docker-ce --showduplicates | sort -r
      
      docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
      docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
      docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
      docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable
      

      The list returned depends on which repositories are enabled, and is specific to your version of CentOS (indicated by the .el7suffix in this example).

      b. Install a specific version by its fully qualified package name, which is the package name (docker-ce) plus the version string (2nd column) starting at the first colon (:), up to the first hyphen, separated by a hyphen (-). For example, docker-ce-18.09.1.

      $ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
      

      Docker is installed but not started. The docker group is created, but no users are added to the group.

      整个2是个指定版本的类似操作

    3. Start Docker

      sudo systemctl start docker
      
    4. Verify that Docker Engine is installed correctly by running the hello-world image.

      sudo docker run hello-world
      

      This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

    Docker Engine is installed and running. You need to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.

    现在还只能sudo命令, 继续可以授权给其他users

    Upgrade Docker Engine

    To upgrade Docker Engine, download the newer package file and repeat the installation procedure, using yum -y upgrade instead of yum -y install, and pointing to the new file.

    (未完, 先使用)

    2.2 Install from a package

    2.3 Install using the convenience script

    3 Uninstall Docker Engine

  • 相关阅读:
    unp.h
    美拍视频下载
    动态加载ajax 腾讯视频评论
    已知二叉树的先序,中序遍历,求后续遍历

    JSP九大内置对象及四个作用域
    转换数据库连接池为hikaricp
    JSP Tomcat8.0运行连接池时发生异常【AbstractMethodError oracle.jdbc.driver.T4CConnection.isValid(I)Z】
    tomcat启动时出现There are no resources that can be added or removed from the server
    java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener问题解决
  • 原文地址:https://www.cnblogs.com/clzhang/p/12772977.html
Copyright © 2020-2023  润新知