Install Docker Engine on CentOS-CentOSにDockerをインストール-公式サイトのドキュメントに基づく-2020年

7594 ワード

文書ディレクトリ

  • Install Docker Engine on CentOS
  • 1 Prerequiresites
  • 1.1 OS requirements
  • 1.2 Uninstall old versions
  • 2 Installation methods
  • 2.1 Install using the repository
  • SET UP THE REPOSITORY
  • Install Docker Engine
  • Upgrade Docker Engine
  • 2.2 Install from a package
  • 2.3 Install using the convenience script
  • 3 Uninstall Docker Engine

  • 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.
    インストールを開始する前に、Prerequiresitesを先に読んでください.

    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


    メインが来ました
  • 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 install or 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グループは作成されましたが、usersは追加されていません.
  • 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 .el7 suffix 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- docker-ce-cli- containerd.io
    

    Docker is installed but not started. The docker group is created, but no users are added to the group.
    2全体が指定されたバージョンの類似操作
  • です.
  • Start Docker
    sudo systemctl start docker
    
  • 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