Skip to Content
Docker:入门与实践,第三版
book

Docker:入门与实践,第三版

by Sean P. Kane, Karl Matthias
May 2025
Intermediate to advanced
418 pages
5h 47m
Chinese
O'Reilly Media, Inc.
Content preview from Docker:入门与实践,第三版

第 10 章 大规模容器 大规模容器

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

容器的一个主要优势是能够抽象出底层硬件和操作系统,因此您的应用程序不会受限于任何特定主机或环境。它不仅便于在数据中心内横向扩展无状态应用程序,还能跨云提供商进行扩展,而不会遇到许多传统障碍。按照运输容器的比喻,一个云上的容器看起来就像另一个云上的容器。

许多企业发现,Linux 容器的交钥匙云部署很有吸引力,因为它们可以获得基于容器的可扩展平台的许多直接优势,而无需完全在内部构建。尽管如此,在 Cloud 或自己的数据中心构建自己的平台的门槛其实很低,我们很快就会介绍一些这样做的选择。

主要的公共云提供商 都致力于在其产品中原生支持 Linux 容器。在公共云中支持 Linux 容器的最大努力包括以下几个方面:

许多同样的公司也有类似的强大托管 Kubernetes 产品:

在某个公共云中的 Linux 实例上安装 Docker 是件小事。但将 Docker 安装到服务器上通常只是创建完整生产环境的一个步骤。你可以完全靠自己完成这项工作,也可以使用主要云提供商、Docker 公司和更广泛的容器社区提供的许多工具。许多工具在公共云或您自己的数据中心都同样适用。

在调度器和更复杂的工具系统领域,我们有很多系统可供选择,它们可以复制公共云提供商提供的大部分功能。即使你在公共云中运行,也有一些令人信服的理由让你选择运行自己的 Linux 容器环境,而不是使用现成的产品。

在本章中,我们将介绍一些大规模运行 Linux 容器的选项,首先介绍简单得多的 Docker Swarm 模式,然后深入探讨一些更高级的工具,如 Kubernetes 和一些大型云产品。所有这些示例都会让你了解如何利用 Docker 为你的应用工作负载提供一个极其灵活的平台。

Docker 群模式

在以 Docker 引擎的形式构建了容器运行时 之后,Docker 的工程师们转而研究如何协调由单个 Docker 主机组成的舰队,并有效地将这些主机装满容器。从这项工作中发展出来的第一个工具叫做 Docker Swarm。正如我们在早期解释的那样,现在有两种叫作 "Swarm "的东西,它们都来自 Docker 公司。

最初的独立 Docker Swarm 现在通常被称为Docker Swarm(经典),但还有第二个 "Swarm "实现,更具体地说就是Swarm 模式。它不是一个独立的产品,而是内置于 Docker 客户端中。内置的 Swarm 模式比原来的 Docker Swarm 能力强很多,其目的是完全取代它。Swarm 模式的主要优点是不需要单独安装任何东西。你已经在运行 Docker 的任何系统上拥有了这种集群能力!这就是我们在这里要重点介绍的 Docker Swarm 实现。希望现在你已经知道有两种不同的 Docker Swarm 实现,就不会再被互联网上相互矛盾的信息所迷惑了。

Docker Swarm 模式 背后的理念是为docker 客户端工具提供单一界面,但让该界面由整个集群而非单一 Docker 守护进程提供支持。Swarm 的主要目的是通过 Docker 工具管理集群计算资源。自首次发布以来,它已经有了长足的发展,现在包含多个调度器插件,采用不同的策略将容器分配给主机,并内置了一些基本的服务发现功能。但它仍然只是更复杂解决方案的一个组成部分。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
超越Vibe编程

超越Vibe编程

Addy Osmani
写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik

Publisher Resources

ISBN: 9798341656826