Install Docker Engine on CentOS

OS Requirements 系统要求

To install Docker Engine,you need a maintained version of CentOS 7. Archives versions arent supported or testes.

要安装Docker引擎,需要CentOS 7的维护版本。不支持或测试存档版本。

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

必须启用centos-extras存储库。默认情况下该存储库是启用的,但是如果您已经禁用了它,则需要重新启用它。

The overlay2 storage driver is recommended.

建议使用overlay2存储驱动程序。

Uninstall old versions 卸载旧版本

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

Docker的旧版本被称为DockerDocker -engine。如果安装了这些,请卸载它们以及相关的依赖项。

$ 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.

如果yum报告没有安装这些包,就说明可以了

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

保存/var/lib/docker/的内容,包括图像、容器、卷和网络。Docker Engine包现在称为Docker -ce。

Installation methods

You can install Docker Engine in different ways, depending on your needs:

你可以根据需要,使用不同的方式安装

  • Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.
  • 大多数用户设置了Docker的存储库并从它们进行安装,以方便安装和升级任务。这是推荐的方法。在线安装
  • Some users download the RPM package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.
  • 一些用户下载RPM包并手动安装,并完全手动管理升级。这在一些情况下非常有用,比如在没有访问internet的被隔离的系统上安装Docker。离线安装
  • In testing and development environments, some users choose to use automated convenience scripts to install Docker.
  • 在测试和开发环境中,一些用户选择使用自动化的方便脚本来安装Docker。

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.

首次安装Dcoker Engine之前,需要设置Docker repository,然后从rspository安装和更新Docker

  • 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-config-manager 程序)并设置稳定的存储库,国内用户需要使用阿里存储库

    $ sudo yum install -y yum-utils
    
    $ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    阿里源
    $ sudo yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/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.

    这些存储库包含在docker中的repo文件,但默认情况下是禁用的。您可以在稳定存储库的同时启用它们。下面的命令启用了每日存储库。

    $ 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.

    您可以通过运行带有 -disable标志的yum-config-manager命令来禁用每日存储库或测试存储库。要重新启用它,使用·--enable标志。下面的命令禁用夜间存储库。

    $ sudo yum-config-manager --disable docker-ce-nightly
  • INSTALL DOCKER ENGINE 安装Docker Engine

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

    ​ 安装Docker Engine和containerd的最新版本,或者进入下一步安装特定版本:

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

    ​ 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密钥,请验证指纹是否与060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35匹配,如果匹配,请接受。

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

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

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

    a.列出并排序可用的版本。这个示例按照版本号对结果进行排序。从最高到最低并截断

    $ 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).

    ​ 返回的列表取决于启用了哪些存储库,并且特定于您的CentOs版本

    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,

    ​ b.通过完全限定的包名安装一个特定版本,包名是包名(docker-ce)加上版本字符串(第二列),从第一个冒号(:)开始,直到第一个连字符,用连字符(-)分隔。例如,docker-ce-18.09.1

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

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

    Docker已安装,但尚未启动。docker组被创建,但是没有用户被添加到组中

  1. Start Docker.

    $ sudo systemctl start docker
  2. 添加国内的镜像源,否则后续无法验证

    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
    "registry-mirrors": ["https://xaw9lc34.mirror.aliyuncs.com"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
  3. 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.

Install Docker Engine on CentOS 在CentOS 7 上安装Docker的更多相关文章

  1. 阿里云cenos 6.5 模板上安装 docker

    本章将介绍在阿里云的 Centos6.5 模板上安装 Docker 以及在 Ubuntu 14.04 模板上安装 Docker 的过程 Centos 6.5 模板上使用Docker 首先,通过 ssh ...

  2. 2300+字!在不同系统上安装Docker!看这一篇文章就够了

    辰哥准备出一期在Docker跑Python项目的技术文,比如在Docker跑Django或者Flask的网站.跑爬虫程序等等. 在Docker跑Python程序的时候不会太过于细去讲解Docker的基 ...

  3. 简单介绍一下在CentOS上安装Docker。

    简单介绍一下在CentOS上安装Docker. 前置条件: 64-bit 系统 kernel 3.10+ 1.检查内核版本,返回的值大于3.10即可. $ uname -r 2.使用 sudo 或 r ...

  4. 在Centos 7上安装Docker

    在Centos 7上安装Docker 1.docker介绍 docker是类似于vmware的虚拟化软件,可以开发.容纳.运行应用程序的平台,在容器中安全的隔离运行应用程序. 2.Docker引擎 D ...

  5. CentOS 6.5系统上安装SVN服务器端的方法及步骤

    VN其实就是Subversion,分为服务器端和客户端.之前在网上搜了很多方法,都有各种问题,经过自己搜集整理以及实际尝试,总算有个比较靠谱的方法.本文主要介绍CentOS 6.5系统上安装SVN服务 ...

  6. CentOS 7 / RHEL 7 上安装 LAMP + phpMyAdmin

    原文 CentOS 7 / RHEL 7 上安装 LAMP + phpMyAdmin 发表于 2014-11-02 作者 Haoxian Zeng 更新于 2014-12-12   之前根据在 Lin ...

  7. 在Linux(CentOS 6.6)服务器上安装并配置基于Apache的SVN服务器

    #!/bin/bash # # 在Linux(CentOS 6.6)服务器上安装并配置基于Apache的SVN服务器: # # .安装服务 # .创建svn版本库 # .创建svn用户 # .配置sv ...

  8. CentOS 6.5系统上安装SVN服务器端的方法及目录访问权限配置(转总结)

    SVN其实就是Subversion,分为服务器端和客户端.之前在网上搜了很多方法,都有各种问题,经过自己搜集整理以及实际尝试,总算有个比较靠谱的方法.本文主要介绍CentOS 6.5系统上安装SVN服 ...

  9. 在Ubuntu上安装Docker Engine

    在Ubuntu上安装Docker Engine 这篇文章是介绍如何在在Ubuntu上安装Docker Engine,就是Google翻译官方文档的版本,英语好的直接官方原文.原文 要在Ubuntu上开 ...

随机推荐

  1. jvm源码解读--01 jvm加载java/lang/object过程

    现在做一下记录,这个看了两天,看的过程发现了很多c++的高级特性,没接触过,还得慢慢撸,禁止很慢 那么现在开始 吧 先打两个断点 java.c:351 JavaMain(void * _args) { ...

  2. idea 提示不能打开cmd.exe,idea 编译项目 CreateProcess error=740, 请求的操作需要提升 --->如何设置cmd以管理员身份运行

    问题描述:idea 编译项目 idea 编译项目 CreateProcess error=740, 请求的操作需要提升 CreateProcess error=740, 请求的操作需要提升 全网搜索可 ...

  3. dotnet 是 前30个增长最快速度的开源项目中排名第一的开发平台

    CNCF 的博客 发了一篇文章 <Update on CNCF and Open Source Project Velocity 2020>,中文翻译参见 2020年CNCF和开源项目开发 ...

  4. 还在用Postman?来,花2分钟体验下ApiPost的魅力

    2分钟玩转APIPOST 本文通过简单介绍如何利用ApiPost调试接口和快速的生成接口文档,让您初步体验ApiPost的魅力! 1. API写完想要测试?试试模拟发送一次请求 新建接口,我想模拟发送 ...

  5. SpringCloud升级之路2020.0.x版-7.从Bean到SpringCloud

    本系列为之前系列的整理重启版,随着项目的发展以及项目中的使用,之前系列里面很多东西发生了变化,并且还有一些东西之前系列并没有提到,所以重启这个系列重新整理下,欢迎各位留言交流,谢谢!~ 在理解 Spr ...

  6. RHCAS_DAY06

    vi/vim文本编辑器 Vim是从 vi 发展出来的一个文本编辑器,vim 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性 vi/vim 共分为三种模式:命令模式.输入模式.底线命令模式(末 ...

  7. USB 3.0 开发要点

    最近在公司里安排了我一个新的任务,那就是USB3.0的研发.对于我之前都是做ARM+LINUX和单片机软件研发的来说,虽然之前都是做驱动程序和应用程序,但是没有做与USB 相关的开发,毕竟这是第一次. ...

  8. 9、改善深度神经网络之正则化、Dropout正则化

    首先我们理解一下,什么叫做正则化? 目的角度:防止过拟合 简单来说,正则化是一种为了减小测试误差的行为(有时候会增加训练误差).我们在构造机器学习模型时,最终目的是让模型在面对新数据的时候,可以有很好 ...

  9. 深入理解-dl_runtime_resolve

    深入理解-dl_runtime_resolve 概要 目前大部分漏洞利用常包含两个阶段: 首先通过信息泄露获取程序内存布局 第二步才进行实际的漏洞利用 然而信息泄露的方法并不总是可行的,且获取的内存信 ...

  10. kali2020更换JDK&&安装burpsuite pro

    写在前面 之前因为安装maven把JDK换成了1.8.0_261,尝试诸多方法依然打不开自带的burp,正好在做CTF做不出来 QAQ,一气之下打算安个破解版burp. 安装 0x00 更换JDK 使 ...