Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: 伊恩·米尔(Ian Miell) & 艾丹·霍布森·塞耶斯(Aidan Hobson Sayers)

Rating No ratings yet

本书由浅入深地讲解了Docker的相关内容,涵盖从开发环境到DevOps流水线,再一路到生产环境的整个落地过程以及相关的实用技巧。书中介绍Docker的核心概念和架构,以及将Docker和开发环境有机、高效地结合起来的方法,包括用作轻量级的虚拟机以及构建和宿主机编排、配置管理、精简镜像等。不仅如此,本书还通过“问题/解决方案/讨论”的形式,将“Docker如何融入DevOps流水线”“如何在生产环境落地”等一系列难题拆解成101个相关的实用技巧,为读者提供解决方案以及一些细节和技巧方面的实践经验。阅读本书,读者将学到的不只是Docker,还包括持续集成、持续交付、构建和镜像管理、容器编排等相关领域的一线生产经验。本书编写时一些案例参考的Docker版本是Docker 1.9。 本书要求读者具备一定的容器管理和运维的基础知识,适合想要将Docker投入实践的相关技术人员阅读,尤其适合具有中高级DevOps和运维背景的读者阅读。

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on, recipe-driven guide for mid-to-senior DevOps and operations engineers who want to move Docker beyond experiments and into real development, CI/CD, and production workflows—packed with 101 practical techniques for solving concrete problems. 【Book Arc】 - **Opening (~0%–9%)**: Introduces Docker's core value proposition—why containers beat VMs and configuration management sprawl—and sets up the book's structure: four parts covering basics, development, DevOps pipelines, and production. The preface and foreword frame the authors' early-adopter experience at OpenBet. - **Early (~9%–25%)**: Covers Docker fundamentals: the key concepts of images, containers, and layers, plus the main CLI commands (`build`, `run`, `commit`, `tag`). A walkthrough builds a simple to-do app with a Dockerfile, demonstrating how to create, run, and inspect containers. - **Early (~25%–34%)**: Deepens the hands-on foundation by explaining the four ways to create images (manual, Dockerfile, config management tools, and importing files), then details the build process, port mapping, container lifecycle management, and the copy-on-write layering mechanism that makes containers fast and disk-efficient. - **Middle (~34%–47%)**: Shifts to architecture and operational techniques. Covers the Docker daemon, client, registry, and Hub, with tips on exposing the daemon over TCP, running containers as daemons with restart policies, and moving Docker data to different partitions. Emphasizes debugging and non-standard configurations. - **Middle (~47%–end of sample)**: Continues with practical daily-use techniques: managing volumes for persistence, running containers in the background, cleaning up resources, and using tools like DockerUI and dependency graphs. The book then moves into configuration management, DevOps integration, networking, orchestration, security, and production troubleshooting (per the roadmap). 【Key Takeaways】 - **Images are classes; containers are objects** (Early): This analogy clarifies the core distinction—containers are isolated, runnable instances of a static image, and changes inside a container don't affect the image. Understanding this is foundational for everything else. - **Dockerfile is a simple, ordered command sequence** (Early): It mixes filesystem changes (`RUN`) with metadata (`EXPOSE`, `CMD`, `WORKDIR`). Building a to-do app from a `node` base image shows how a few lines can replace complex installation instructions. - **Copy-on-write layering is what makes Docker fast and cheap** (Early): Containers share underlying layers, so starting hundreds of them doesn't duplicate disk usage. This is a critical operational advantage over VMs for scaling tests and environments. - **Four ways to create images, not just one** (Early): Manual `docker commit`, Dockerfile, config management tools, and importing a TAR of files each fit different scenarios—from quick proofs-of-concept to complex builds where Dockerfile alone is insufficient. - **Run containers as services with `-d` and restart policies** (Middle): The `--restart` flag (`no`, `always`, `on-failure`) lets you manage container lifecycle predictably, but beware: `always` with a quick-exiting command causes a restart loop, and container IDs persist across restarts. - **Exposing the Docker daemon is powerful but dangerous** (Middle): Opening it via TCP (`-H tcp://0.0.0.0:2375`) enables remote debugging and workflow integration, but it's a privilege-escalation risk—always restrict to specific IP ranges, never bind to all interfaces. - **Volumes and data containers solve persistence** (Middle): The book addresses the "where does my data go?" problem with techniques like data containers, SSHFS, NFS, and distributed volumes, which are essential for real development workflows. 【Reading Tips】 - **Skim the first two chapters if you're already comfortable with Docker basics**—the to-do app walkthrough and core concepts are well-trodden ground; the real value starts with the architecture and debugging tips in Chapter 2. - **Treat the book as a recipe book, not a cover-to-cover read**—each "problem/solution/discussion" technique is self-contained, so jump to the section that matches your current pain point (e.g., persistence, networking, security). - **Deep-read the sections on daemon security and restart policies**—these are easy to get wrong in production and have subtle failure modes (like the `--restart=always` loop) that the authors illustrate with concrete examples. - **Pay attention to the Docker version caveat**—the book targets Docker 1.9, so commands and behaviors may differ in modern versions; use the techniques as conceptual guides, not verbatim instructions. - **Take away the mental model of "container as a process"**—this framing helps you reason about lifecycle, logging, and debugging in ways that translate to any container runtime, not just Docker. 【Coverage Limits】 This guide covers the sampled excerpts (roughly the first half of the book), which focus on Docker fundamentals, development workflows, and early operational techniques. The later parts on DevOps pipelines, networking, orchestration, security, and production troubleshooting are only summarized from the roadmap and are not covered in detail here.
Excerpt 1
巧46 传统方式:搭配make和Docker 技巧47 借助Chef Solo构建镜像 技巧48 从源到镜像的构建 5.3 小即是美 技巧49 保持构建镜像更小的Dockerfile技巧 技巧50 让镜像变得更小的技巧 技巧51 通过BusyBox和Alpine来精简Docker镜像 技巧52 Go模型的最小容器...
View in text
Excerpt 2
,以及论坛里的一些行为准则。 Manning对读者的承诺是会为其提供一个读者之间以及读者和作者之间进行有价值讨论的场所。但并不承诺作者的参与程度,作者对论坛的贡献目前仍然还是停留在志愿性质(并且是无报酬的)。我们建议读者试着问一些有挑战的问题,以激发作者回答问题的兴趣!作者在线论坛和之前讨论的档案只要书还在发行就...
View in text
Excerpt 3
todo.git ---> Running in 0a030ee746ea Cloning into 'todo'... ---> 783c68b2e3fc Removing intermediate container 0a030ee746ea Step 3 : WORKDIR todo ---> Runnin...
View in text
Excerpt 4
hello daemon (2) ^] (3)     telnet> q (4) Connection closed. $ docker logs daemon (5) hello daemon $ docker rm daemon (6)  daemon $ (1)使用telnet命令连接到容器的netcat...
View in text
Excerpt 5
wordpress介绍画面,并可设置这个wordpress实例。 这个示例的关键在于第二条命令里的 --link 标志。这个标志会设置容器的host文件以便wordpress容器能够引用mysql服务器,这将被路由到具有“wp-mysql”名称的容器。这有很大的好处,即无须对wordpress容器做任何改动,就可...
View in text
Excerpt 6
)在原则上是一致的——需要拿到整个文件系统的TAR,然后用 ADD 命令将TAR文件加到 scratch 镜像的 / 。 ADD 命令  在镜像中拥有 ADD 命令时,Dockerfile的 ADD 命令(不像它的兄弟命令 COPY )会自动将TAR文件(gzip压缩过的文件以及其他一些类似的文件类型也是如此)解...
View in text
Excerpt 7
e/mysite 每当 db 、 app 或者 conf 文件夹下的内容有一个发生变化,将会只有一个容器需要被重新构建。当有超过3个以上的容器又或者有一些对时间敏感的配置步骤时,这样做会特别有用——只要花上一些心思,在每个步骤中添加最低限度的所需文件,结果便是可以最大程度地利用Dockerfile的缓存机制。在应...
View in text
Excerpt 8
是读者的可能会不一样),代表两种选择。当CEO来评估其想要的方案时,可以把两个镜像都运行起来,然后让她决定要提交哪一个。 可以通过打开新的终端然后执行如下命令来实现这一点: $ docker run -p 8001:8000 \ ca76b45144f2cb31fda6a31e55f784c93df8c9d4c9...
View in text
Tags
AI categories
DevOpsCloud NativeBackend
Publish Year: 2018
Language: Chinese
File Format: EPUB
File Size: 4.6 MB