100% found this document useful (3 votes)
113 views

Immediate Download Using Docker Developing and Deploying Software With Containers 1st Edition Adrian Mouat Ebooks 2024

Developing

Uploaded by

swadylimp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
113 views

Immediate Download Using Docker Developing and Deploying Software With Containers 1st Edition Adrian Mouat Ebooks 2024

Developing

Uploaded by

swadylimp
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Using Docker Developing and Deploying


Software with Containers 1st Edition Adrian
Mouat

https://textbookfull.com/product/using-docker-
developing-and-deploying-software-with-
containers-1st-edition-adrian-mouat/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Docker containers build and deploy with Kubernetes Flannel


Cockpit and Atomic First Printing Edition Henry

https://textbookfull.com/product/docker-containers-build-and-deploy-
with-kubernetes-flannel-cockpit-and-atomic-first-printing-edition-
henry/
textbookfull.com

The DevOps 2 1 Toolkit Docker Swarm Building testing


deploying and monitoring services inside Docker Swarm
clusters 1st Edition Viktor Farcic
https://textbookfull.com/product/the-devops-2-1-toolkit-docker-swarm-
building-testing-deploying-and-monitoring-services-inside-docker-
swarm-clusters-1st-edition-viktor-farcic/
textbookfull.com

The SQL Server Dba■s Guide to Docker Containers: Agile


Deployment Without Infrastructure Lock-in 1st Edition
Edwin M Sarmiento
https://textbookfull.com/product/the-sql-server-dba%c2%92s-guide-to-
docker-containers-agile-deployment-without-infrastructure-lock-in-1st-
edition-edwin-m-sarmiento/
textbookfull.com

CRISPR People: The Science and Ethics of Editing Humans


1st Edition Henry T. Greely

https://textbookfull.com/product/crispr-people-the-science-and-ethics-
of-editing-humans-1st-edition-henry-t-greely/

textbookfull.com
Foundations for Lifelong Learning John Piper

https://textbookfull.com/product/foundations-for-lifelong-learning-
john-piper/

textbookfull.com

Site Reliability Engineering How Google Runs Production


Systems 1st Edition Betsy Beyer

https://textbookfull.com/product/site-reliability-engineering-how-
google-runs-production-systems-1st-edition-betsy-beyer/

textbookfull.com

Controlled Radical Polymerization at and from Solid


Surfaces 1st Edition Philipp Vana (Eds.)

https://textbookfull.com/product/controlled-radical-polymerization-at-
and-from-solid-surfaces-1st-edition-philipp-vana-eds/

textbookfull.com

Oxford Handbook of Rheumatology Gavin Clunie

https://textbookfull.com/product/oxford-handbook-of-rheumatology-
gavin-clunie/

textbookfull.com

Stages of Digital Economy Development and Problems of Use


of Modern ICT on Uzbekistan Enterprises 2nd Edition
Bobokhujaev Shukhrat Ismoilovich
https://textbookfull.com/product/stages-of-digital-economy-
development-and-problems-of-use-of-modern-ict-on-uzbekistan-
enterprises-2nd-edition-bobokhujaev-shukhrat-ismoilovich/
textbookfull.com
Ocular Fluid Dynamics Anatomy Physiology Imaging
Techniques and Mathematical Modeling Giovanna Guidoboni

https://textbookfull.com/product/ocular-fluid-dynamics-anatomy-
physiology-imaging-techniques-and-mathematical-modeling-giovanna-
guidoboni/
textbookfull.com
Using
Docker
DEVELOPING AND DEPLOYING SOFTWARE WITH CONTAINERS

Adrian Mouat
www.it-ebooks.info
www.it-ebooks.info
Using Docker

Adrian Mouat

Boston

www.it-ebooks.info
Using Docker
by Adrian Mouat
Copyright © 2016 Adrian Mouat. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].

Editor: Brian Anderson Indexer: WordCo Indexing Services


Production Editor: Melanie Yarbrough Interior Designer: David Futato
Copyeditor: Christina Edwards Cover Designer: Randy Comer
Proofreader: Amanda Kersey Illustrator: Rebecca Demarest

December 2015: First Edition

Revision History for the First Edition


2015-12-07: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781491915769 for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Using Docker, the cover image, and
related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.

978-1-491-91576-9
[LSI]

www.it-ebooks.info
To those who try, whether they fail or succeed.

www.it-ebooks.info
www.it-ebooks.info
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

Part I. Background and Basics

1. The What and Why of Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


Containers Versus VMs 4
Docker and Containers 6
Docker: A History 8
Plugins and Plumbing 10
64-Bit Linux 10

2. Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Installing Docker on Linux 13
Run SELinux in Permissive Mode 14
Running Without sudo 15
Installing Docker on Mac OS or Windows 15
A Quick Check 17

3. First Steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Running Your First Image 19
The Basic Commands 20
Building Images from Dockerfiles 24
Working with Registries 27
Private Repositories 29
Using the Redis Official Image 30
Conclusion 33

www.it-ebooks.info
4. Docker Fundamentals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
The Docker Architecture 35
Underlying Technologies 36
Surrounding Technologies 37
Docker Hosting 39
How Images Get Built 39
The Build Context 39
Image Layers 41
Caching 43
Base Images 44
Dockerfile Instructions 46
Connecting Containers to the World 49
Linking Containers 49
Managing Data with Volumes and Data Containers 51
Sharing Data 53
Data Containers 54
Common Docker Commands 55
The run Command 56
Managing Containers 59
Docker Info 62
Container Info 62
Dealing with Images 63
Using the Registry 66
Conclusion 67

Part II. The Software Lifecycle with Docker

5. Using Docker in Development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71


Say “Hello World!” 71
Automating with Compose 81
The Compose Workflow 83
Conclusion 84

6. Creating a Simple Web App. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85


Creating a Basic Web Page 86
Taking Advantage of Existing Images 88
Add Some Caching 93
Microservices 96
Conclusion 97

vi | Table of Contents

www.it-ebooks.info
7. Image Distribution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Image and Repository Naming 99
The Docker Hub 100
Automated Builds 102
Private Distribution 104
Running Your Own Registry 104
Commerical Registries 111
Reducing Image Size 111
Image Provenance 113
Conclusion 114

8. Continuous Integration and Testing with Docker. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115


Adding Unit Tests to Identidock 116
Creating a Jenkins Container 121
Triggering Builds 128
Pushing the Image 129
Responsible Tagging 129
Staging and Production 131
Image Sprawl 131
Using Docker to Provision Jenkins Slaves 132
Backing Up Jenkins 132
Hosted CI Solutions 133
Testing and Microservices 133
Testing in Production 135
Conclusion 135

9. Deploying Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137


Provisioning Resources with Docker Machine 138
Using a Proxy 141
Execution Options 147
Shell Scripts 148
Using a Process Manager (or systemd to Rule Them All) 150
Using a Configuration Management Tool 153
Host Configuration 157
Choosing an OS 157
Choosing a Storage Driver 157
Specialist Hosting Options 160
Triton 160
Google Container Engine 162
Amazon EC2 Container Service 162
Giant Swarm 165
Persistent Data and Production Containers 167

Table of Contents | vii

www.it-ebooks.info
Sharing Secrets 167
Saving Secrets in the Image 167
Passing Secrets in Environment Variables 168
Passing Secrets in Volumes 168
Using a Key-Value Store 169
Networking 170
Production Registry 170
Continuous Deployment/Delivery 171
Conclusion 171

10. Logging and Monitoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173


Logging 174
The Default Docker Logging 174
Aggregating Logs 176
Logging with ELK 176
Docker Logging with syslog 187
Grabbing Logs from File 193
Monitoring and Alerting 194
Monitoring with Docker Tools 194
cAdvisor 196
Cluster Solutions 197
Commercial Monitoring and Logging Solutions 201
Conclusion 201

Part III. Tools and Techniques

11. Networking and Service Discovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205


Ambassadors 206
Service Discovery 210
etcd 210
SkyDNS 215
Consul 219
Registration 223
Other Solutions 225
Networking Options 226
Bridge 226
Host 227
Container 228
None 228
New Docker Networking 228
Network Types and Plugins 230

viii | Table of Contents

www.it-ebooks.info
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Networking Solutions 230
Overlay 231
Weave 233
Flannel 237
Project Calico 242
Conclusion 246

12. Orchestration, Clustering, and Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249


Clustering and Orchestration Tools 250
Swarm 251
Fleet 257
Kubernetes 263
Mesos and Marathon 271
Container Management Platforms 282
Rancher 282
Clocker 283
Tutum 285
Conclusion 286

13. Security and Limiting Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289


Things to Worry About 290
Defense-in-Depth 292
Least Privilege 292
Securing Identidock 293
Segregate Containers by Host 295
Applying Updates 296
Avoid Unsupported Drivers 299
Image Provenance 300
Docker Digests 300
Docker Content Trust 301
Reproducible and Trustworthy Dockerfiles 305
Security Tips 307
Set a User 307
Limit Container Networking 309
Remove Setuid/Setgid Binaries 311
Limit Memory 312
Limit CPU 313
Limit Restarts 314
Limit Filesystems 314
Limit Capabilities 315
Apply Resource Limits (ulimits) 316
Run a Hardened Kernel 318

Table of Contents | ix

www.it-ebooks.info
Linux Security Modules 318
SELinux 319
AppArmor 322
Auditing 322
Incident Response 323
Future Features 324
Conclusion 324

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

x | Table of Contents

www.it-ebooks.info
Preface

Containers are a lightweight and portable store for an application and its dependencies.

Written down by itself, this sounds dry and boring. But the process improvements
made possible by containers are anything but; used correctly, containers can be game-
changing. So persuasive is the lure of the architectures and workflows made possible
by containers that it feels like every major IT company has gone in a year from never
having heard of Docker or containers to actively investigating and using them.
The rise of Docker has been astonishing. I don’t remember any technology that has
had such a fast and profound effect on the IT industry. This book is my attempt to
help you understand why containers are so important, what you stand to gain from
adopting containerization and, most importantly, how to go about it.

Who Should Read This Book


This book tries to take a holistic approach to Docker, explaining the reasons for using
Docker and showing how to use it and how to integrate it into a software-
development workflow. The book covers the entire software lifecycle, from develop‐
ment through to production and maintenance.
I have tried to avoid assuming too much of the reader beyond a basic knowledge of
Linux and software development in general. The intended readership is primarily
software developers, operations engineers, and system administrators (particularly
those keen to develop a DevOps approach), but technically informed managers and
enthusiasts should also be able to get something out of this book.

Why I Wrote This Book


I was in the fortunate position to learn about and use Docker while it was still in the
early stages of its meteoric rise. When the opportunity to write this book appeared, I
leapt at it with both hands. If my scribblings can help some of you to understand and

xi

www.it-ebooks.info
make the most of the containerization movement, I will have achieved more than I
have in years of developing software.
I truly hope that you enjoy reading this book and that it helps you on the path to
using Docker in your organization.

Navigating This Book


This book is organized roughly as follows:

• Part I starts by explaining what containers are and why you should be interested
in them, before going into a tutorial chapter showing the basics of Docker. It ends
with a large chapter explaining the fundamental concepts and technology in
Docker, including an overview of the various Docker commands.
• Part II explains how to use Docker in a software-development lifecycle. It starts
by showing how to set up a development environment, before building a simple
web application that is used as an ongoing example through the rest of Part II.
The chapter covers development, testing, and integration, as well as how to
deploy containers and how to effectively monitor and log a production system.
• Part III goes into advanced details and the tools and techniques needed to run
multihost clusters of Docker containers safely and reliably. If you are already
using Docker and need to understand how to scale up or solve networking and
security issues, this is for you.

Conventions Used in This Book


The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.

xii | Preface

www.it-ebooks.info
This icon signifies a tip, suggestion, or general note.

This icon indicates a warning or caution.

Using Code Examples


Supplemental material (code examples, exercises, etc.) is available for download at
https://github.com/using-docker/.
This book is here to help you get your job done. In general, if example code is offered
with this book, you may use it in your programs and documentation. You do not
need to contact us for permission unless you’re reproducing a significant portion of
the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing a CD-ROM of examples
from O’Reilly books does require permission. Answering a question by citing this
book and quoting example code does not require permission. Incorporating a signifi‐
cant amount of example code from this book into your product’s documentation does
require permission.
We appreciate, but do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “Using Docker by Adrian Mouat
(O’Reilly). Copyright 2016 Adrian Mouat, 978-1-491-91576-9.”
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at [email protected].

Safari® Books Online


Safari Books Online is an on-demand digital library that deliv‐
ers expert content in both book and video form from the
world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research,
problem solving, learning, and certification training.

Preface | xiii

www.it-ebooks.info
Safari Books Online offers a range of plans and pricing for enterprise, government,
education, and individuals.
Members have access to thousands of books, training videos, and prepublication
manuscripts in one fully searchable database from publishers like O’Reilly Media,
Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que,
Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kauf‐
mann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders,
McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more
information about Safari Books Online, please visit us online.

How to Contact Us
Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.


1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://bit.ly/using-docker.
To comment or ask technical questions about this book, send email to bookques‐
[email protected].
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments
I am immensely grateful for all the help, advice, and criticism I received during the
writing of this book. If I missed your name in the following list, please accept my
apologies; your contribution was appreciated whether I acted on it or not.
For their generous feedback, I would like to thank Ally Hume, Tom Sugden, Lukasz
Guminski, Tilaye Alemu, Sebastien Goasguen, Maxim Belooussov, Michael Boelen,

xiv | Preface

www.it-ebooks.info
Ksenia Burlachenko, Carlos Sanchez, Daniel Bryant, Christoffer Holmstedt, Mike
Rathbun, Fabrizio Soppelsa, Yung-Jin Hu, Jouni Miikki, and Dale Bewley.
For technical conversations and input on specific technologies in the book, I would
like to thank Andrew Kennedy, Peter White, Alex Pollitt, Fintan Ryan, Shaun Cramp‐
ton, Spike Curtis, Alexis Richardson, Ilya Dmitrichenko, Casey Bisson, Thijs
Schnitger, Sheng Liang, Timo Derstappen, Puja Abbassi, Alexander Larsson, and Kel‐
sey Hightower. For allowing me to reuse monsterid.js, I would like to thank Kevin
Gaudin.
For all their help, I would like to thank the O’Reilly staff, in particular my editor Brian
Anderson and Meghan Blanchette, for starting the whole process.
Diogo Mónica and Mark Coleman—thanks to both of you for answering my last-
minute plea for help.
A particular shout-out has to go to two companies: Container Solutions and Cloud‐
Soft. Jamie Dobson and Container Solutions kept me busy blogging and speaking at
events, and put me in contact with several people who had an impact on this book.
CloudSoft graciously allowed me to use their office during the writing of this book
and hosted the Edinburgh Docker meetup, both of which were very important to me.
For putting up with my obsession and moaning over the book, I would like to thank
all my friends and family; you know who you are (and are unlikely to read this any‐
way).
Finally, I would like to thank the BBC 6 Music DJs who provided the soundtrack to
this book, including Lauren Laverne, Radcliffe and Maconie, Shaun Keaveny, and
Iggy Pop.

Preface | xv

www.it-ebooks.info
www.it-ebooks.info
PART I
Background and Basics

In the first part of this book, we’ll start by taking look at what containers are and why
they are becoming so popular. This is followed by an introduction to Docker and the
key concepts you need to understand to make the most of containers.

www.it-ebooks.info
www.it-ebooks.info
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
CHAPTER 1
The What and Why of Containers

Containers are fundamentally changing the way we develop, distribute, and run soft‐
ware. Developers can build software locally, knowing that it will run identically
regardless of host environment—be it a rack in the IT department, a user’s laptop, or
a cluster in the cloud. Operations engineers can concentrate on networking, resour‐
ces, and uptime and spend less time configuring environments and battling system
dependencies. The use and uptake of containers is increasing at a phenomenal rate
across the industry, from the smallest start ups to large-scale enterprises. Developers
and operations engineers should expect to regularly use containers in some fashion
within the next few years.
Containers are an encapsulation of an application with its dependencies. At first
glance, they appear to be just a lightweight form of virtual machines (VMs)—like a
VM, a container holds an isolated instance of an operating system (OS), which we
can use to run applications.
However, containers have several advantages that enable use cases that are difficult or
impossible with traditional VMs:

• Containers share resources with the host OS, which makes them an order of
magnitude more efficient. Containers can be started and stopped in a fraction of
a second. Applications running in containers incur little to no overhead com‐
pared to applications running natively on the host OS.
• The portability of containers has the potential to eliminate a whole class of bugs
caused by subtle changes in the running environment—it could even put an end
to the age-old developer refrain of “but it works on my machine!”
• The lightweight nature of containers means developers can run dozens of con‐
tainers at the same time, making it possible to emulate a production-ready dis‐

www.it-ebooks.info
tributed system. Operations engineers can run many more containers on a single
host machine than using VMs alone.
• Containers also have advantages for end users and developers outside of deploy‐
ing to the cloud. Users can download and run complex applications without
needing to spend hours on configuration and installation issues or worrying
about the changes required to their system. In turn, the developers of such appli‐
cations can avoid worrying about differences in user environments and the avail‐
ability of dependencies.

More importantly, the fundamental goals of VMs and containers are different—the
purpose of a VM is to fully emulate a foreign environment, while the purpose of a
container is to make applications portable and self-contained.

Containers Versus VMs


Though containers and VMs seem similar at first, there are some important differ‐
ences, which are easiest to explain using diagrams.
Figure 1-1 shows three applications running in separate VMs on a host. The hypervi‐
sor1 is required to create and run VMs, controlling access to the underlying OS and
hardware as well as interpreting system calls when necessary. Each VM requires a full
copy of the OS, the application being run, and any supporting libraries.
In contrast, Figure 1-2 shows how the same three applications could be run in a con‐
tainerized system. Unlike VMs, the host’s kernel2 is shared with the running contain‐
ers. This means that containers are always constrained to running the same kernel as
the host. Applications Y and Z use the same libraries and can share this data rather
than having redundant copies. The container engine is responsible for starting and
stopping containers in a similar way to the hypervisor on a VM. However, processes
running inside containers are equivalent to native processes on the host and do not
incur the overheads associated with hypervisor execution.
Both VMs and containers can be used to isolate applications from other applications
running on the same host. VMs have an added degree of isolation from the hypervi‐
sor and are a trusted and battle-hardened technology. Containers are comparatively
new, and many organizations are hesitant to completely trust the isolation features of
containers before they have a proven track record. For this reason, it is common to

1 The diagram depicts a type 2 hypervisor, such as Virtualbox or VMWare Workstation, which runs on top of a
host OS. Type 1 hypervisors, such as Xen, are also available where the hypervisor runs directly on top of the
bare metal.
2 The kernel is the core component in an OS and is responsible for providing applications with essential system
functions related to memory, CPU, and device access. A full OS consists of the kernel plus various system
programs, such as init systems, compilers, and window managers.

4 | Chapter 1: The What and Why of Containers

www.it-ebooks.info
find hybrid systems with containers running inside VMs in order to take advantage
of both technologies.

Figure 1-1. Three VMs running on a single host

Figure 1-2. Three containers running on a single host

Containers Versus VMs | 5

www.it-ebooks.info
Docker and Containers
Containers are an old concept. For decades, UNIX systems have had the chroot com‐
mand that provides a simple form of filesystem isolation. Since 1998, FreeBSD has
had the jail utility, which extended chroot sandboxing to processes. Solaris Zones
offered a comparatively complete containerization technology around 2001 but was
limited to the Solaris OS. Also in 2001, Parrallels Inc, (then SWsoft) released the
commercial Virtuozzo container technology for Linux and later open sourced the
core technology as OpenVZ in 2005.3 Then Google started the development of
CGroups for the Linux kernel and began moving its infrastructure to containers. The
Linux Containers (LXC) project started in 2008 and brought together CGroups, ker‐
nel namespaces, and chroot technology (among others) to provide a complete con‐
tainerization solution. Finally, in 2013, Docker brought the final pieces to the
containerization puzzle, and the technology began to enter the mainstream.
Docker took the existing Linux container technology and wrapped and extended it in
various ways—primarily through portable images and a user-friendly interface—to
create a complete solution for the creation and distribution of containers. The Docker
platform has two distinct components: the Docker Engine, which is responsible for
creating and running containers; and the Docker Hub, a cloud service for distributing
containers.
The Docker Engine provides a fast and convenient interface for running containers.
Before this, running a container using a technology such as LXC required significant
specialist knowledge and manual work. The Docker Hub provides an enormous
number of public container images for download, allowing users to quickly get
started and avoid duplicating work already done by others. Further tooling developed
by Docker includes Swarm, a clustering manager; Kitematic, a GUI for working with
containers; and Machine, a command-line utility for provisioning Docker hosts.
By open sourcing the Docker Engine, Docker was able to grow a large community
around Docker and take advantage of public help with bug fixes and enhancements.
The rapid rise of Docker meant that it effectively became a de facto standard, which
led to industry pressure to move to develop independent formal standards for the
container runtime and format. In 2015, this culminated in the establishment of the
Open Container Initiative, a “governance structure” sponsored by Docker, Microsoft,
CoreOS, and many other important organizations, whose mission is to develop such
a standard. Docker’s container format and runtime forms the basis of the effort.
The uptake of containers has largely been driven by developers, who for the first time
were given the tools to use containers effectively. The fast start-up time of Docker

3 OpenVZ never achieved mass adoption, possibly because of the requirement to run a patched kernel.

6 | Chapter 1: The What and Why of Containers

www.it-ebooks.info
containers is essential to developers who crave quick and iterative development cycles
where they can promptly see the results of code changes. The portability and isolation
guarantees of containers ease collaboration with other developers and operations;
developers can be sure their code will work across environments, and operations can
focus on hosting and orchestrating containers rather than worrying about the code
running inside them.
The changes brought about by Docker are significantly changing the way we develop
software. Without Docker, containers would have remained in the shadows of IT for
a long time to come.

The Shipping Metaphor


The Docker philosophy is often explained in terms of a shipping-container metaphor,
which presumably explains the Docker name. The story normally goes something like
this:
When goods are transported, they have to pass through a variety of different means,
possibly including trucks, forklifts, cranes, trains, and ships. These means have to be
able to handle a wide variety of goods of different sizes and with different require‐
ments (e.g., sacks of coffee, drums of hazardous chemicals, boxes of electronic goods,
fleets of luxury cars, and racks of refrigerated lamb). Historically, this was a cumber‐
some and costly process, requiring manual labor, such as dock workers, to load and
unload items by hand at each transit point (Figure 1-3).
The transport industry was revolutionized by the introduction of the intermodal con‐
tainer. These containers come in standard sizes and are designed to be moved
between modes of transport with a minimum of manual labor. All transport machi‐
nery is designed to handle these containers, from the forklifts and cranes to the
trucks, trains, and ships. Refrigerated and insulated containers are available for trans‐
porting temperature sensitive goods, such as food and pharmaceuticals. The benefits
of standardization also extend to other supporting systems, such as the labeling and
sealing of containers. This means the transport industry can let the producers of
goods worry about the contents of the containers so that it can focus on the move‐
ment and storage of the containers themselves.
The goal of Docker is to bring the benefits of container standardization to IT. In
recent years, software systems have exploded in terms of diversity. Gone are the days
of a LAMP4 stack running on a single machine. A typical modern system may include
Javascript frameworks, NoSQL databases, message queues, REST APIs, and backends
all written in a variety of programming languages. This stack has to run partly or
completely on top of a variety of hardware—from the developer’s laptop and the in-
house testing cluster to the production cloud provider. Each of these environments is

4 This originally stood for Linux, Apache, MySQL, and PHP—common components in a web application.

Docker and Containers | 7

www.it-ebooks.info
Random documents with unrelated
content Scribd suggests to you:
this simple, Gospel way, wait the Lord’s leisure, and He will comfort
your heart.
“I hope you take care to have little or nothing else mentioned to
you but His praises and promises. Your tongue and ears are going to
be silent in the grave. Now, or never, you must use them to hear and
speak good of His name. Comfort your weeping friends. Reprove the
backsliders. Encourage seekers. Remember the praying, believing,
preaching, though dying thief. Be not afraid to drop a word for Him
who opens a fountain of blood for you. Suffer, live, die at His feet;
and you will soon revive, sing, and reign in His bosom for evermore.
Farewell, in the Conqueror of Death and Prince of Life.
“J. Fletcher.”[164]

Within three months after the date of this letter,


Miss Ireland had left a world of sin and suffering, and
had entered into that rest which remains for the
[165]
people of God. Hence the following, addressed to
her father:—
“Madeley, March 26, 1769.
“My Dear Friend,—The Lord is desirous of making you a true
disciple of His dear Son, the ‘Man of Sorrows,’ by sending you
affliction upon affliction. A sister and a wife who appear to hasten to
the grave in which you have so lately laid your only daughter, places
you in circumstances of uncommon sorrow. But in this see the finger
of Him who works all in all, and who commands us to forsake all to
follow Him. Believe in Him. Believe that He does all for the best; and
that all shall work for good to those who love Him. His goodness to
your daughter ought to encourage your faith and confidence for Mrs.
Ireland. Offer her upon the altar, and you shall see that, if it be best
for her and you, His grace will suspend the blow which threatens
you.
“Your rich present of meal came last week, and shall be distributed
to the pious poor agreeably to your orders. We are happy to receive
your bounty, but you are more happy in bestowing it upon us.
Witness the words of Jesus, ‘It is more blessed to give than to
receive.’ Nevertheless, receive, by faith, the presents of the Lord, the
gifts of His Spirit, and reject not the bread which cometh down from
heaven, because the Lord gives it you with so much love.
“I shall be obliged to go to Switzerland this year or the next, if I
live and the Lord permits. I have there a brother, a worthy man, who
threatens to leave his wife and children to come and pay me a visit if
I do not go and see him myself. It is some time since our gracious
God convinced him of sin, and I have some of his letters which give
me great pleasure. This circumstance has more weight with me than
the settlement of my affairs.”[166]

Mr. Ireland was a frequent benefactor to Fletcher


and the poor of Madeley. Hence, in another letter to
the same friend in need, Fletcher wrote:—
“I think I wrote my last letter two days before I received your
bounty—a large hogshead of rice and two cheeses. Accept the
thanks of your poor and mine. I distributed your gifts on Shrove
Tuesday; and preached to a numerous congregation on ‘Seek ye first
the kingdom of God and His righteousness, and all other things shall
be added unto you.’ We prayed for our benefactor, that God would
give him a hundredfold in this life, and eternal life, where life eternal
will be no burden.”[167]

Help, like Mr. Ireland’s, was always welcome. Many


of Fletcher’s parishioners were extremely poor, and to
the utmost of his ability he contributed to their
necessities. One who knew him writes:—
“The profusion of his charity toward the poor and needy is scarcely
credible. It constantly exhausted his purse; it frequently unfurnished
his home; and sometimes left him destitute of the common
necessaries of life. That he might feed the hungry, he led a life of
abstinence and self-denial; and that he might cover the naked, he
clothed himself in the most homely attire.”[168]

Fletcher was President, or, as Wesley chose to call


him more correctly, Visitor of Trevecca College. The
office brought upon him considerable anxiety and
labour. In the summer of 1769, John Jones made
application to be appointed head master. Mr. Jones,
from 1746 to 1767, had been one of Wesley’s
itinerant preachers. He was one of the first classical
masters of Kingswood School, and wrote the Latin
[169]
Grammar which was used in that academy. He was
highly esteemed by Wesley, and after he left
Kingswood was generally stationed in Wesley’s two
most important circuits, London and Bristol. In 1754,
when there was great excitement respecting a
possible separation of the Methodists from the
Church of England, Charles Wesley wished what he
called “the sound preachers” to be “qualified for
orders,” and wrote to his brother, saying, “I know
none fitter for training up the young men in learning
than yourself or J. Jones.” Nine years after this, when
Erasmus, a bishop of the Greek Church, visited
London, he, at Wesley’s request, ordained Jones to
assist the Arch-Methodist in administering the
sacraments to his Societies. Charles Wesley would
not admit the validity of this ordination, and
consequently would not allow Mr. Jones to officiate as
a clergyman. This was a severe trial to the newly-
ordained preacher, and led him to leave the
Methodists. He afterwards procured ordination from
the Bishop of London, and was presented to the
living of Harwich, where he continued to preach for
many years, and where he ended his days in peace.
[170]
He never lost his love for Wesley. In 1775, when
Wesley was dangerously ill in Ireland, he wrote to
him from Harwich:—
“I cannot express what I felt when I was informed you were both
senseless and speechless; and it was like life from the dead when I
heard you were out of danger and able to sit up. Time was when you
would have taken my advice, at least in some things. Let me entreat,
let me beseech you, to preach less frequently, and that only at the
principal places,” etc.[171]

Such was John Jones, Wesley’s friend, and at one


time held in high esteem by Wesley’s brother Charles.
His ambition to be employed in Lady Huntingdon’s
college at Trevecca was not inordinate. Fifteen years
before, Charles Wesley had thought him qualified to
train young men for the ministry, and from one of his
letters, written in 1777, and published in the
Wesleyan Methodist Magazine for 1837, it is evident
that Charles Wesley’s opinion was well founded. The
letter was addressed to a gentleman of Magdalene
College, Cambridge, who was about to be ordained,
and wished Mr. Jones’s advice respecting the
composition of sermons and preaching them.
“Prayer,” said he, “should always precede the composing of a
discourse. In general, the explication of the text or context, if they
need it, should not be too short. The propositions or doctrines should
not be too long nor too many, and the clearer they are the better.
The illustrations should be proper and lively; the proofs close and
home; the motives strong and cogent; the inferences and application
natural, and not laboured. For if we cannot persuade the passions,
we shall go but a little way with most of our hearers. This was
George Whitefield’s peculiar talent; but I do not mean to persuade
you to bawl as loud as he did, and yet I would advise you to raise
your voice in the application of your discourse. Eight-and-thirty years
ago I thought it an easy matter to prove most points in divinity. I
have been learning the contrary ever since, and I find it now very
difficult, by Scriptures properly understood and applied, to prove
many things which I once thought quite clear. I find it necessary to
understand the Scripture I bring in as a proof before I use it as such.
I will add one thing more. You will find it very difficult to use such
plain language as will be understood in most congregations. Avoid
long periods as much as possible. Imitate Cæsar rather than Cicero;
leave the latter to Dr. Middleton and Samuel Furley. It is far better to
be understood by our hearers than to be admired by getting out of
their depth. To do all the good we can is our one business in life.”

Mr. Jones was a man of sense, and piety, and


experience; and yet Fletcher hesitated in
recommending him to be appointed a tutor in
Trevecca College. Did Fletcher sympathize with his
friend Charles Wesley in the repugnance which the
latter felt to Mr. Jones’s ordination by Erasmus, the
bishop of the Greek Church? Perhaps so; at all
events, the following letter to the Countess of
Huntingdon was cautious, if not cold:—
“Madeley, July 1, 1769.
“My Lady,—Mr. Jones’s letter puzzled me a little. I did not know
what answer to make to it. I have, however, sat down, and, after an
introduction, I say to him—
“‘The first and grand point to be kept in view at Lady Huntingdon’s
College is to maintain and grow in the spirit of faith and power that
breathes through the Acts of the Apostles, and was exemplified in
the lives of the primitive Christians. The first and grand qualification
required in a person called to be at the head of such a college is,
then, a degree of faith and power from above, with an entire
devotedness to God and His cause.
“‘The master, who is there at present, seems, on account of his
youth, to be deficient in point of experience. Nor is he a proper
master of the Greek, nor even of the harder classics; so that he can
hardly maintain his superiority over those who read Cicero and
Horace. Whether this inconveniency, Sir, would be avoided,
supposing you were appointed to succeed him, I cannot judge by
your letter. He is also unacquainted with divinity and the sciences, of
which it is proper he should give the students some idea; and how
far you may excel him in these points, Sir, is not in my power to
determine. He has twenty-five guineas a year, with his board, room,
and washing. I dare say the generous foundress would not hesitate
to raise the salary of a master of superior merit, though she hopes
none would undertake that office for the sake of money.’
“After giving Mr. Jones a little account of the business of the
College, I add—
“‘The variety of classes in it demands great assiduity and diligence
in the master. I would not, therefore, advise anyone to engage
without a proper trial. I have begged of Lady Huntingdon not to fix
upon a master till she had allowed him to look about him, and see
how he liked the place, people, and business; and, as you very
properly observe, Sir, it would be improper to engage, and then to
repent of the undertaking. I think that, if, upon consulting with the
Lord in prayer, and with Mr. Maxfield in conversation, you find your
heart free to embrace so peculiar an opportunity of being useful to
your generation, it might be best to come and see how you like the
business, and how it agrees with you; and should not matters prove
agreeable on either side, I dare say Lady Huntingdon will pay your
travelling expenses to Talgarth,[172] and back again.’
“In a letter to Mr. Maxfield,[173] I desired him to inform your
ladyship how Mr. Jones’s mind stands after reflecting on the contents
of my letter to him, and whether he would go to make a trial. I add,
that so much depends upon the aptness to teach, Christian
experience, solidity, liveliness, and devotedness of a master, that no
one can presume to judge of these things by a letter, or even by a
day’s conversation.
“If your ladyship does not approve of this step, a line to Mr.
Maxfield will rectify what you think amiss, and will oblige, my lady,
your unworthy servant,
“J. Fletcher.
“P.S.—If your ladyship is so good as to spare a minister for three
weeks, I shall be glad to wait upon the dear young men and their
patroness at the College.”[174]

This is an important letter, not only as exhibiting


the views of Fletcher, but as containing a curious
chapter in the earliest history of Trevecca College.
The College, as it was ostentatiously called, had been
opened ten months. It had one master; and the
author of the “Life and Times of the Countess of
Huntingdon” says Joseph Easterbrook was the person
who occupied this position; but adduces no proof in
support of his assertion. Another, and a far greater
authority, attests that the master of the College was
a child. Who was he?
In 1788, there was printed “A Sermon, occasioned
by the Death of the celebrated Mr. J. Henderson,
B.A., of Pembroke College, Oxford: Preached at St.
George’s, Kingswood, November 23; and at Temple
Church, Bristol, November 30, 1788. By the Rev.
William Agutter, M.A., of St. Mary Magdalen College,
Oxford. Published at the request of the
Congregations. Bristol. 1788.” 8vo, pp. 32. The text
of the sermon is, “Moses was learned in all the
wisdom of the Egyptians.” Mr. Agutter’s eulogy of
Henderson cannot here be quoted at full length: the
following are brief extracts from it:—
“Mr. Henderson was born, as it were, a thinking being; and was
never known to cry, or to express any infantine peevishness. The
questions he asked, as soon as he was able to speak, astonished all
who heard him.”
“His memory was so strong that he retained all he read; and his
judgment so solid that he arranged, examined, and digested all that
he remembered, and thus made it his own.”
“At a time that other children were employed in the drudgery of
learning words, he was occupied in obtaining the knowledge of
things. While but a boy, he was engaged to teach the learned
languages. At twelve years of age, he taught Greek and Latin in the
College of Trevecca. The Governor of the College at that time was
the Rev. Mr. Fletcher, late Vicar of Madeley.”[175]

Mr. Agutter proceeds to say, that, when Fletcher


was dismissed from Trevecca, Henderson was
dismissed with him.
This, then, was the master—the only master of
Trevecca College during the first year of its existence
—a child, a wonderful child, twelve years old! A
further account of this prodigy, or, as the Monthly
Review, of 1789, called him, “a second Baratier,”
[176]

may interest the reader.


His father was a native of Ireland, and, from 1759
to 1771, was one of Wesley’s best itinerant
preachers,—a man of deep piety, great talent, and
amiable disposition; but naturally of a timid and
melancholy mind. On relinquishing the itinerancy, he
commenced a boarding-school at Hannam, near
Bristol; but two of his pupils having been drowned
while bathing, his mind was so affected, that he
abandoned his school, and opened, at the same
place, an asylum for the insane, which Wesley
pronounced the best of the kind in the three
kingdoms.
John Henderson, his only child, was born at
Bellgaran, near Limerick, in 1757, and, as early as
possible, was sent to Wesley’s School, at Kingswood.
At the age of eight, he had made such proficiency in
the Latin language, as to be able to teach it in the
school. In his twelfth year, as already stated, he
became the Master in Trevecca College. When about
fourteen years of age, he left Trevecca, and,
probably, spent the next ten years with his father at
Hannam. At twenty-four, he entered Pembroke
College, Oxford; and, in due time, took the degree of
Bachelor of Arts. His thirst after knowledge was
unbounded; and his amiable temper and remarkable
talents secured him the respect of all who knew him.
His learning was deep and multifarious. He was
skilled in grammar, rhetoric, history, logic, ethics,
metaphysics, and scholastic theology. He studied
medicine with great attention, and practised it among
the poor, wherever he had a chance, gratuitously. He
was well versed in geometry, astronomy, and every
branch of natural and experimental philosophy, and
also in civil and canon laws. Besides several of the
modern languages, he was master of the Greek and
Latin tongues; and was intimately acquainted with
Persic and Arabic. Scarcely a book could be
mentioned, but he could give some account of it; nor
any subject started, but he could engage in the
discussion of it. His talents for conversation were so
attractive, various, and multiform, that he was a
companion equally acceptable to the philosopher and
the man of the world, to the gay, the learned, and
illiterate, the young and the old of both sexes. He
attracted the notice of Dr. Johnson, was intimate with
Sir William Jones, Miss Hannah More, and other
celebrities; and Mr. Wilberforce offered him his
patronage and a living, if he would reside in London.
Like most geniuses, John Henderson was eccentric.
When he first went to Oxford, his clothes were made
in a fashion peculiar to himself; he had no stock or
neckcloth; and he wore his hair like that of a boy at
school. His mode of life was singular. He generally
went to bed at daybreak, and rose in the afternoon,
except when he was obliged to attend the morning
service of the college chapel. Before he retired to
rest, he frequently stripped himself naked to the
waist, took his station at a pump near his rooms,
sluiced his head and the upper part of his body,
pumped water over his shirt, and then, putting it on,
went to bed. This he jocularly called “an excellent
cold bath.” He became an ardent admirer of the
nonsense of Jacob Behmen’s wild philosophical
divinity; studied Lavater’s “Physiognomy;” and
attained to a considerable knowledge of magic and
astrology; and declared the possibility of holding
correspondence with the spirits of the dead, upon the
strength of his own experience.
He died at Oxford, on November 2, 1788, and was
buried at St. George’s, Kingswood. His father was so
painfully affected by the loss of his affectionate and
only child, that he caused the corpse to be taken up
again, several days after the interment, to satisfy
[177]
himself that his son was really dead.
Wesley had great love and respect for poor
Henderson’s father, and, a few months after the
young man’s untimely death, he wrote:—
“1789, March 13.—I spent some time with poor Richard
Henderson, deeply affected with the loss of his only son; who, with
as great talents as most men in England, had lived two-and-thirty
years, and done just nothing.”[178]
This, however, was scarcely true. Henry Moore, in
[179]
his “Life of Wesley,” relates an anecdote which is
worth preserving, and which must conclude this
lengthened notice of the child professor at the
Countess of Huntingdon’s College at Trevecca. In
reference to Wesley’s entry in his Journal, Mr. Moore
remarks:—
“Not a vestige of Mr. Henderson’s writings remains. This is owing
to what some would call a cross providence. He used to visit his
father at Hannam, near Bristol, in the summer vacation. He there
studied intensely, and wrote largely. His MSS. he stored in a large
trunk without a lock. Returning home, some time before his last
illness, he flew to his treasure, but found the trunk empty. He
enquired of Mrs. Henderson, who called up the servant, and asked
for the papers in the trunk. The girl, who had been hired that year,
replied with great simplicity, ‘La! ma’am, I thought they were good
for nothing, and so I lighted the fire with them during the winter.’ Mr.
Henderson looked at his excellent mother-in-law for some time, but
spoke not a word. He then went into his study, and was never known
to mention the subject more.”

“Oh! Diamond, Diamond! thou little knowest the


mischief thou hast done!” said Sir Isaac Newton to
his favourite little dog, who, by upsetting a taper on
his desk, had set fire to the papers which contained
the whole of his unpublished experiments, and thus
reduced to ashes the labours of many years. Poor
Henderson, in his misfortune, “spoke not a word.”
Newton lived thirty years after his great loss, but
made no important addition to his scientific
discoveries; Henderson died soon after his sad
calamity; and hence Wesley’s disparaging remark
concerning him: “With as great talents as most men
in England, he lived two-and-thirty years, and did just
nothing.” Wesley must have been ignorant of the fact
related by Mr. Moore; for, on no other ground can an
apology be framed for his unfair remark.
It is time to return to Fletcher. Wesley was not
present at the opening of Trevecca College, in 1768,
but he took part in the religious services held at the
first anniversary in 1769. Whitefield was unavoidably
absent, for he was preaching farewell sermons, and
administering farewell sacraments, to his London
congregations, and, a week afterwards, set out on his
final visit to America. But, even without him, the
Methodist gathering at Trevecca was one of the most
remarkable recorded in old Methodist history. Besides
Wesley and Fletcher, there were present Howell
Harris, the founder of the Welsh Methodists; the Rev.
Daniel Rowlands, rector of Llangeitho, with a salary
of £10 a year, a preacher whose eloquence was
overwhelming, and whose meetings among the
Welsh mountains can never be forgotten; the Rev.
William Williams, curate of Lanwithid, a brave-
hearted man who had met violent persecution
without flinching, and a member of the first
Conference of the Calvinistic Methodists in Wales, in
1743; Howell Davies, rector of Prendergast, an
intimate friend of Whitefield, a preacher whom
thousands upon thousands flocked to hear, in fields,
and on commons and mountains, and the attendance
at whose monthly sacraments was so great that his
church had to be emptied several times over to make
room for the remaining communicants waiting out of
doors; the Rev. Peter Williams, another itinerant
clergyman of the Established Church, who joined the
Methodists as early as the year 1741; and the Hon.
and Rev. Walter Shirley, brother of the notorious Earl
Ferrers, first cousin of the Countess of Huntingdon,
converted under the ministry of Venn, and now an
earnest minister of Christ; to whom must be added
Lady Huntingdon, the Countess of Buchan, Lady
Anne Erskine, and Miss Orton, and also the first
students of Trevecca, headed by their juvenile
master, John Henderson.
The services were held daily for a whole week,
from the 19th to the 25th of August inclusive.
Fletcher, Rowlands, and William Williams arrived at
the College on Friday, the 18th, and next morning
Rowlands preached in the chapel to a crowded
congregation, from the words, “Lord, are there few
that be saved?” In the afternoon, the Lord’s Supper
was administered, Fletcher addressing the
communicants and spectators, and Williams giving
out a hymn, which was sung with great enthusiasm.
At night, Howell Harris preached to a large
congregation assembled in the court from the text,
“The time is come that judgment must begin at the
house of God.” During the day, Walter Shirley and
several lay preachers arrived at Trevecca.
On Sunday, August 20, at ten in the morning,
Fletcher read the Liturgy in the court, and Shirley
preached on, “Acquaint thyself now with Him, and be
at peace.” At one, the Lord’s Supper was
administered in the chapel, and Rowlands, Fletcher,
and Williams gave addresses. During the afternoon,
Fletcher preached in the court to an immense
congregation, from, “I am not ashamed of the Gospel
of Christ.” When his sermon was ended, Rowlands, in
the Welsh language, addressed the crowd from, “It is
appointed unto men once to die.”
On Monday and Tuesday the clergymen preached,
and Howell Harris and several of the lay preachers
joined in the services.
On Wednesday, August 23rd, Wesley came,
[180]
accompanied by Howell Davies and Peter Williams.
Wesley writes:—
“Wednesday, August 23rd. I went on to Trevecca. Here we found a
concourse of people from all parts, come to celebrate the Countess
of Huntingdon’s birthday, and the anniversary of her school, which
was opened on the twenty-fourth of August, last year. I preached in
the evening to as many as her chapel could well contain; which is
extremely neat, or rather, elegant; as is the dining-room, the school,
and all the house. About nine, Howell Harris desired me to give a
short exhortation to his family. I did so; and then went back to my
lady’s, and laid me down in peace.
“Thursday, August 24th. I administered the Lord’s Supper to the
family.[181] At ten, the public service began. Mr. Fletcher preached an
exceeding lively sermon in the court, the chapel being far too small.
After him, Mr. William Williams preached in Welsh till between one
and two o’clock. At two we dined. Meantime, a large number of
people had baskets of bread and meat carried to them in the court.
At three, I took my turn there; then Mr. Fletcher; and about five, the
congregation was dismissed. Between seven and eight, the lovefeast
began, at which, I believe, many were comforted. In the evening,
several of us retired into the neighbouring wood, which is exceeding
pleasantly laid out in walks, one of which leads to a little mount
raised in the midst of a meadow that commands a delightful
prospect. This is Howell Harris’s work, who has likewise greatly
enlarged and beautified his house; so that, with the gardens,
orchards, walks, and pieces of water that surround it, it is a kind of
little paradise.”[182]

This is not the place to enlarge upon Howell


Harris’s establishment, which adjoined Trevecca
College. Suffice it to say, that here he had gathered
together a family of more than a hundred persons,
“all diligent, all constantly employed, all fearing God
[183]
and working righteousness.”
The lovefeast mentioned by Wesley was the
concluding service on the first anniversary day,
strictly speaking, of Trevecca College. At that
lovefeast, Walter Shirley, Howell Davies, and Daniel
Rowlands gave short exhortations, and Peter Williams
and Howell Harris offered prayers. Lady Huntingdon
observes:—
“Truly our God was in the midst of us, and many felt Him
eminently nigh. The gracious influence of His Spirit seemed to rest
on every one. Words fail to describe the holy triumph with which the
great congregation sang—

‘Captain of Thine enlisted host,


Display thy glorious banner high,’ etc.

It was a season of refreshing from the presence of the Lord—a time


never to be forgotten.”

Next morning, Wesley set off for Bristol; but the


services were continued. In the afternoon, Shirley
took his stand on the scaffold in the court, and
addressed the multitude from the words, “Wherefore
He is able also to save them to the uttermost that
come unto God by Him, seeing He ever liveth to
make intercession for them.”
“From that time,” wrote Lady Huntingdon, “we had public
preaching every day at four o’clock, whilst Mr. Shirley and Mr.
Fletcher remained. Copious showers of Divine blessing have been felt
on every side. Truly God is good to Israel. Continue Thy goodness,
and in much greater abundance! O that I may be more and more
useful to the souls of my fellow-creatures! I want to be, every
moment, all life, all zeal, all activity for God, and ever on the stretch
for closer communion with Him. My soul pants to live more to Him;
and to be more holy in heart and life, that all my nature may show
the glories of the Lamb.”[184]

Alas! that these glorious scenes among the Welsh


mountains should so soon be followed by scenes of
discord and of disputes. The great storm of the
Calvinian controversy was already brewing.
Walter Sellon occupies a rather unique position in
Methodistic annals. He died in 1792, at the age of
seventy-seven; and yet of the first thirty, and the last
twenty-two years of his life, hardly anything is
known. Dr. Abel Stevens, in his “History of
Methodism,” says Sellon was originally a baker; but I
know of no authority for this, except Toplady’s,
whose hatred and abuse of Sellon were such as to
justify a hesitancy in believing a statement
concerning his stout antagonist, which he intended to
be injurious to his fame. Sellon was born in the year
1715; but up to the year 1745 he had not been
introduced to Wesley. In a letter to Wesley, dated
December 31, 1744, he states, that, until recently, he
had condemned him as “an innovator,” and had
“pitied those who followed” him. But, having heard
Wesley preach, and having read his sermon on
“Scriptural Christianity,” delivered before the Oxford
University on August 24, 1744, his opinions
concerning him and his followers were entirely
changed; and he now requested Wesley, when he
had an opportunity, to preach at Maidenhead, “where
drunkenness, adultery, profaneness, gaming, and
almost every abominable vice, were not only
committed with greediness, but gloried in, and
[185]
boasted of.” Whether Wesley went to Maidenhead,
which seems to have been Sellon’s place of
residence, is not known; but, three years and a half
afterwards, when he opened his famous Kingswood
School, Walter Sellon was appointed the Headmaster
[186]
“for the Classics.” About the year 1754, Sellon
received episcopal ordination, and became curate of
the churches of Smisby, near Ashby-de-la-Zouch, and
of Breedon, where vast multitudes flocked to hear
him, “not only from adjacent towns and villages, but
frequently from places ten, fifteen, and twenty miles
distant.” “He was a real Methodist,” wrote Jonathan
Edmondson, “and hundreds were turned to God
[187]
through his instrumentality.” Sellon enjoyed the
confidential friendship of Wesley, and especially of
Wesley’s brother Charles; and, about the time of his
appointment to his curacies, stood faithfully by them
in their contentions with the most able and prominent
of their itinerant preachers, concerning the
separation of the Methodists from the Established
Church. All his publications were controversial; and
all, except his first, were written specially in defence
of the anti-Calvinian doctrines Wesley taught. This is
not the place to review Walter Sellon as an author.
Suffice it to say, that he was always powerful, rather
than polite; and that, after his first publication, in
1765, which was levelled at Socinianism, he prepared
a second in 1768, which was entitled, “Arguments
against the Doctrine of General Redemption
considered.” Without noticing, at present, the
subsequent writings of Sellon, it is enough to add,
that, about the year 1770, he was presented by the
Earl of Huntingdon to the Vicarage of Ledsham, in
Yorkshire, where he lived and laboured until his
[188]
death, on June 13, 1792. In an unpublished
manuscript, John Pawson says:—
“I do not believe Mr. Sellon was made the instrument of awakening
a single soul after he came to Ledsham. He was tutor to young Mr.
Medhurst, of Kippax, who lately murdered his wife, and would have
murdered his mother some years ago, if my brother Tarboton had
not rescued her at the hazard of his own life. While in that family, Mr.
Sellon seemed to lose all spirit and life, and, as far as I could learn,
had very little savour of godliness about him. He took not the least
notice of the Methodists, no more than if he had never known them.”

John Pawson was one of Wesley’s most honest and


hardworking itinerants; but he sometimes was more
severe in his strictures than was desirable. His
remark, however, concerning Sellon’s abandonment
of the Methodists was probably correct; for Wesley, in
a letter dated June 10, 1784, wrote to him: “You
used to meet me when I came near you; but you
seem, of late, to have forgotten your old friend and
[189]
brother.”
To return to Fletcher. He and Sellon were well
known to each other. Four years ago, they had
exchanged pulpits for a season, Sellon preaching at
Madeley, and Fletcher at Smisby and Breedon-on-the-
Hill. Now Sellon was entering the arena of
controversy. The expulsion of the Methodist students
from Oxford University, in 1768, had been the means,
incidentally, of bringing some of the chief doctrines of
Calvinism into public notice. Sir Richard Hill, in
defending the students, had warmly advocated
Calvinistic predestination. Dr. Nowell, in answering Sir
Richard, had clearly shown that this predestination
was not the doctrine of the Church of England.
Toplady had rushed to the rescue of his favourite
dogma, and had published his translation of
“Zauchius,” and also his “Letter to Dr. Nowell.” Sellon
was the first of Wesley’s friends who entered the
lists, by preparing and publishing his “Arguments
against the Doctrine of General Redemption
considered. London, 1769.” 12mo. 178 pp. Wesley
encouraged him, and so did Fletcher. The former
wrote as follows:—
“Wakefield, July 9, 1768.
“My Dear Brother,—I am glad you have undertaken the
‘Redemption Redeemed;’ but you must in no wise forget Dr. Owen’s
answer to it: otherwise you will leave a loop-hole for all the Calvinists
to creep out. The Doctor’s evasions you must needs cut in pieces,
either interweaving your answers with the body of the work, under
each head, or adding them in marginal notes.
“Your ever affectionate brother,
“J. Wesley.”[190]
After the book was published, Fletcher wrote to
Sellon the following letter, plainly showing that the
great Calvinian controversy, though as yet in its
incipient state, was causing considerable commotion:

“Madeley, October 7, 1769.
“My Dear Brother,—I thank you for your letter and books. They
came safe to hand, and I shall give you the amount at the first
opportunity. I have inquired what the Calvinists think; but they
choose to be silent,—a sign that they have not any great thing to
object. Mr. R——[191] looked at your book here in my house, and
objected to Ελεησω ον αν ελεω, Rom. ix. 15. He says, ελεω is, ‘I
have mercy,’ not ‘I should have mercy.’ I observed to Mr. Glascott, ‘It
is the subjunctive mood, and may take the sign should, would, or
could, according to the analogy of faith.’
“I long to see Coles[192] answered. My request to you is, that you
would answer him in the cool manner you have the Synod;[193] and
my prayer to God is, that you may be assisted for that important
work.
“I know two strong Calvinist believers, who lately took their leave
of this world with, ‘I shall be damned.’ O, what did all their
professions of perseverance do for them? They left them in the lurch.
May we have the power of God in our souls, and we shall readily
leave unknown decrees to others.
“The Lord give you patience with your brethren! The best way to
confound them is, to preach that kingdom of God which they cast
away, with real righteousness, and present peace and joy in
believing; that is poison to the synodical kingdom.
“I despair of seeing you before I have seen Switzerland, which I
design to visit next winter. Mr. Ireland takes me as far as Lyons in my
way.
“There are some disputes in Lady Huntingdon’s College; but when
the power of God comes, they drop them. The Calvinists are three to
one. Your book I have sent them as a hard nut for them to crack.
“May the Lord spare you, and make you a free, joyful soldier of the
Lord Jesus; as tough against sin and unbelief as you are against
Calvin and the Synod! The Lord has overruled your leaving Smisby
for good. Let us trust in Him, and all will be well. Farewell.
“John Fletcher.”[194]

This episode respecting Walter Sellon is not


irrelevant, and is of considerable importance,
inasmuch as it relates, in part, to the rise of the great
Calvinian controversy of the last century, in which
Fletcher became one of the chief actors. Sellon’s
book, in favour of the doctrine of “General
Redemption,” was the first published by Wesley’s
adherents, and is exceedingly able; but this is not the
place to analyse and give an account of it.
Seventeen years had elapsed since Fletcher left his
father’s house in Switzerland. He had now decided to
pay a visit to the place of his nativity, and to travel as
far as the south of France with his generous friend,
Mr. Ireland, of Brislington, Bristol. The following letter
to Mr. Ireland refers to this contemplated visit, and to
another matter, which must be noticed:—
“Madeley, December 30, 1769.
“My Dear Friend,—Last night, I received your obliging letter, and am
ready to accompany you to Montpelier, provided you will go with me
to Nyon. I shall raise about twenty guineas, and, with that sum, a
gracious Providence, and your purse, I hope we shall want for
nothing. If the Lord sends me, I should want nothing, though I had
nothing, and though my fellow-traveller were no richer than myself.
“I hope to be at Bristol soon, to offer you my services to pack up.
You desired to have a Swiss servant, and I offer myself to you in that
capacity; for I shall be no more ashamed of serving you, as far as I
am capable of doing, than I am of wearing your livery.
“Two reasons (to say nothing of the pleasure of your company)
engage me to go with you to Montpelier,—a desire to visit some poor
Huguenots in the south of France, and the need I have to recover a
little French before I go to converse with my compatriots.
“The priest at Madeley is going to open his mass-house, and I
declared war on that account last Sunday, and propose to strip the
whore of Babylon and expose her nakedness to-morrow. All the
papists are in a great ferment, and have held meetings to consult on
the occasion. One of their bloody bullies came ‘to pick up a quarrel’
with me, as he said, and what would have been the consequence
had I not had company with me I know not. How far more rage may
be kindled to-morrow I don’t know; but I question whether it will be
right for me to leave the field in these circumstances. I forgot to
mention that two of our poor ignorant Churchmen are about to join
the mass-house, which also is the cause of my having taken up
arms.”[195]

Fletcher preached his anti-popery sermon as he


intended, taking as his text 1 Tim. iv. 1–3: “Now the
Spirit speaketh expressly that, in the latter times,
some shall depart from the faith, giving heed to
seducing spirits and doctrines of devils; speaking lies
in hypocrisy; having their conscience seared with a
hot iron; forbidding to marry, and commanding to
abstain from meats, which God hath created to be
received with thanksgiving of them which believe and
know the truth.” An outline of the sermon may be
found in Fletcher’s Collected Works, vol. vii., p. 490.
As the people were leaving the church, a man, who
acted as the spokesman of the papists present, cried,
“There was not a word of truth in the whole sermon;”
and then, turning to Fletcher, assured him that he
would shortly produce a gentleman who would refute
[196]
all that he had said. The threat was not fulfilled;
and Benson, in his “Life of Fletcher,” first published in
1804, remarks:—
“By Mr. Fletcher’s bold and prudent stand the designs of the
papists were in a great measure frustrated, and they were prevented
making any progress worth mentioning in Madeley. It is true there is
even now a mass-house and a priest at Madeley, but I find, upon
inquiry, there are not a dozen Popish families in the parish.”

Fletcher’s intended visit to Switzerland was, for a


little while, deferred; because he deemed it his duty
to await the threatened refutation of his anti-popish
sermon. Hence, early in January 1770, he went to
Trevecca; probably for the purpose of meeting
Joseph Benson, who was about to become head
master of the college.
Joseph Benson was now nearly twenty-two years
of age, and for the last four years had been the
classical master of Wesley’s school at Kingswood, and
was at present keeping terms at Oxford. His
acquaintance with Fletcher was slight, but his
admiration of him great. He writes:—
“I had only had two or three interviews with Mr. Fletcher, which
were, I think, in the year 1768, when I was classical master at
Kingswood school. As he occasionally made an excursion from
Madeley to Bristol and Bath, in one of these excursions we invited
him to preach at Kingswood. He came, and took as his text, ‘Him
that cometh unto Me I will in no wise cast out.’ The people were
exceedingly affected; indeed quite melted down. The tears streamed
so fast from the eyes of the poor colliers that their black faces were
washed by them. As to himself, he was carried out so far beyond his
strength that, when he concluded, he put off his shirt, which was as
wet as if it had been dipped in water. But this was nothing strange;
whenever he preached it was generally the case. From this time, I
conceived a particular esteem for him, chiefly on account of his piety;
and wished much for a further acquaintance with him, a blessing
which I soon after obtained; for through his means, and in
consequence of Mr. Wesley’s recommendation to the Countess of
Huntingdon, I was made head master of the academy, or, as it was
commonly called, the college, at Trevecca, though I could ill be
spared from Kingswood, where I had acted in that capacity about
four years. Being greatly wanted at Kingswood, and having likewise a
term to keep at Oxford, I could only pay them a short visit for the
present, which was in January 1770; but in the spring following, I
went to reside there, and for some time was well satisfied with my
situation.”[197]

No record exists of what transpired between


Fletcher and Benson at Trevecca; but the following
letter, written there, and addressed to Mr. Ireland,
deserves insertion:—
“Trevecca, January 13, 1770.
“My Dear Friend,—I know not what to think of our journey. My
heart frequently recoils. I have lost all hope of being able to preach
in French, and I think if I could they would not permit me. I become
more stupid every day; my memory fails me in a surprising manner. I
am good for nothing, but to go and bury myself in my parish. I have
those touches of misanthropy which make solitude my element.
Judge, then, whether I am fit to go into the world. On the other
hand, I fear that your journey is undertaken partly from
complaisance to me, and in consequence of the engagement we
made to go together. I acquit you of your promise; and, if your
business does not really demand your presence in France, I beg you
will not think of going there on my account. The bare idea of giving
you trouble would make the journey ten times more disagreeable to
me than the season of the year.
“The day after I wrote to you I preached the sermons against
popery, which I had promised to my people; and Mr. S—t—r called
out several times in the churchyard, as the people went out of
church, that ‘there was not one word of truth in the whole of my
discourse, and that he would prove it.’ He also told me that he would
produce a gentleman who should answer my sermon and the
pamphlet I had distributed. I was, therefore, obliged to declare in the
church that I should not quit England, and was only going into
Wales, from whence I would return soon to reply to the answer of
Mr. S—t—r and the priest, if they should offer any. I am thus obliged
to return to Madeley by my word so publicly pledged, as well as to
raise a little money for my journey. Were it not for these
circumstances, I believe I should pay you a visit at Bristol,
notwithstanding my misanthropy.
“The hamper which you mention, and for which I thank you,
provided it be the last, arrived three days before my departure, but
not knowing what it was, nor for whom it was intended, I put it into
my cellar without opening it. I want the living water rather than cider,
and righteousness more than clothes. I fear, however, lest my
unbelief should make me set aside the fountain whence it flows, as I
did your hamper. Be that as it may, it is high time to open the
treasures of Divine mercy, and to seek in the heart of Jesus for the
springs of love, righteousness, and life. The Lord give us grace so to
seek that we may find, and be enabled to say with the woman in the
Gospel, ‘I have found the piece of silver which I had lost.’
“If your affairs do not really call you to France I will wait until
Providence and grace shall open a way to me to the mountains of
Switzerland, if I am ever to see them again. Adieu! Give yourself
wholly to God. A divided heart, like a divided kingdom, falls naturally
by its own gravity either into darkness or into sin. My heart’s desire is
that the love of Jesus may fill your soul, and that of your unworthy
and greatly obliged servant,
“John Fletcher.”[198]

The journey to Switzerland was deferred, but took


place; though no one seems to know the exact date
when it was begun or when it ended. In the month of
July, however, Fletcher was again in England.
Strangely enough, there is no letter of his that refers
to the extensive tour made by him and his friend
Ireland; but the latter sent the following account to
Mr. Benson:—
“I was with Mr. Fletcher, day and night, nearly five months,
travelling all over Italy and France. At that time, a popish priest
resided in his parish, who attempted to mislead the poor people. Mr.
Fletcher, therefore, throughout this journey, attended the sermons of
the Roman Catholic clergy, visited their convents and monasteries,
and conversed with all the most serious among them whom he met
with, in order that he might know their sentiments concerning
spiritual religion. He was so very particular in making observations
respecting the gross and absurd practices of the priests and other
clergy, especially while we were in Italy, that we were frequently in
no small danger of our lives. He wished to attend the Pope’s chapel
at Rome, but I would not consent to accompany him till I had
obtained a promise from him that he would forbear to speak by way
of censure or reproof of what he saw or heard. He met with many
men of science and learning, with whom he conversed freely on
Gospel truths, which most of them opposed with violence. A few
listened and were edified. His whole life, as you well know, was a
sermon; all his conversations were sermons. Even his disputations
with infidels were full of instruction. We met with a gentleman of
fortune, an excellent classical scholar, with whom we continued near
a fortnight at an hotel. He said he had travelled all over Europe, and
had passed through all the Societies in England to find a person
whose life corresponded with the Gospels and with Paul’s Epistles. He
asked me (for it was with me he first began to converse) if I knew
any clergyman or dissenting minister in England, possessed of a
stipend of £100 a year for the cure of souls, who would not leave
them all if he were offered double that amount. I replied in the
affirmative, and pointed to my friend Fletcher; when disputations
commenced, which continued for many days.”[199]

Mr. Gilpin, in Fletcher’s “Portrait of St. Paul,” adds


to this account. He says:—
“This debate was continued, by adjournment, for the space of a
week. Whatever had been said upon the subject by the most
celebrated writers was brought forward, and thoroughly discussed.
Mr. Fletcher repeatedly overcame his antagonist, who regularly lost
his temper and his cause together. Mr. Fletcher took a view of the
Christian’s enviable life, his consolation in trouble, and his tranquillity
in danger; together with his superiority to all the evils of life and the
horrors of death; interspersing his remarks with affectionate
admonitions and powerful persuasives to a rational dependence upon
the truths of the Gospel. At the conclusion of this memorable debate,
the unsuccessful disputant conceived so exalted an idea of his
opponent’s character, that he never afterwards mentioned his name
but with peculiar veneration and regard; and when they met again,
eight years later, in Provence, where the gentleman lived in
affluence, he showed Mr. Fletcher every possible civility, entertained
him at his house in the most hospitable manner, and listened to his
conversation on spiritual subjects with all imaginable attention and
respect.”
Mr. Gilpin mentions another incident of the same
kind. Fletcher, in his travels, met a young gentleman
from Genoa, who had imbibed the infidel notions of
the day. They had a debate, which lasted several
days, from morning till night. The sceptic was
vanquished, and was so struck with the masterly skill
of Fletcher, and his more than parental concern, that,
before they parted, he looked up to his instructor
with reverence, listened to him with admiration, and
desired to be present at morning and evening prayer.
[200]

While at Marseilles, Mr. Ireland procured for


Fletcher the use of a Protestant church in that
neighbourhood; but the engagement to preach in it
caused Fletcher great anxiety, probably because he
had lost his facility in speaking the French language.
He prayed about it earnestly all the week; and when
Sunday morning came, he entreated Mr. Ireland to
inform the minister of the church that he was unable
to fulfil his engagement. Mr. Ireland refused; and
Fletcher was compelled to ascend the pulpit, where
he preached with such effect, that the whole
congregation, among whom were many ministers,
[201]
were in tears.
He determined, while in the south of France, to
visit the Protestants in the Cevennes mountains,
whose fathers had suffered so severely in the cause
of Christ; “the heretics of the Cevennes, those

You might also like