- [Instructor] Now let's briefly touch
on how large systems are being built using Docker today.
So, just to start with, one container
is about as useful as one hand clapping.
It's cool, it's philosophically neat,
maybe you can get something out of it,
but most people want more.
There are many options out there
for orchestrating large systems of Docker containers.
We're just gonna touch on a few
and give you a place to start.
Orchestration systems start your containers,
keep them running, and restart them if they fail.
They also allow the containers to find each other.
If a container gets restarted,
all the machines that were connecting to it
need to be able to find its replacement.
So service discovery's a big part
of any Docker orchestration system.
And making sure that the containers are running in a place
where the resources exist
for them to actually do their job.
Is the storage they need available at that location?
Is there enough RAM?
Is there enough CPU?
Is that machine being taken offline for maintenance?
Does this container need to be moved somewhere else?
So, the easiest to get started with
and the simplest is Docker Compose.
For single machine coordination,
this is the de facto standard.
In fact, you already have it on your computer.
It's designed for testing, development,
staging, generally working on projects
that have more than one container.
But not for serving them in large scale systems
and not for things that scale dynamically.
What it does is it brings up all your containers
and volumes, et cetera, with one command.
You just run Docker Compose up
and it starts all your containers.
Now, for larger systems, there are many choices.
I'm gonna touch on a couple of them here
and talk about how to compare them.
Kubernetes brings a couple of ideas
that are fairly common
to all of the orchestration systems,
but expressed differently everywhere.
It has containers which run programs.
Those are containers in the way
that we usually think of them.
Pods are groups of containers
that are intended to be run together
always on the same system.
So, pods give you approximately as much
as Docker Compose.
But, it's dynamically distributed,
Kubernetes finds a place to run it,
and it provides orchestration and service discovery
and all the other stuff around these pods.
Kubernetes has the idea of services,
which make pods discoverable by others,
accessible to others,
if a connection to a pod that's a part of a service
gets restarted somewhere,
then that service will redirect the traffic
to the new instance.
Kubernetes has an amazingly powerful system of labels
for describing every aspect of your system.
So, you can say, "My service needs to connect to
an instance of version 5.2,
running on this hardware,
and I need an instance that is in the same data center
as this other service."
It's very extensive.
The kubectl command makes scripting
large operations in Kubernetes
if not easy, possible to the extent
that other systems don't.
It gives you sort of a one command interface
to do almost everything with Kubernetes.
And it provides a very flexible system of overlay networking
to allow your containers to find each other
and connect to each other
regardless of how things move around
throughout your infrastructure.
Kubernetes runs equally well
on your own hardware or on a cloud provider,
or even across both of these.
Its overlay networking system
is quite well-suited to a wide variety
of deployment scenarios.
And it has service discovery built in.
To get started, head on over to kubernetes.io,
head over to the documentation page,
and click on Get Started.
Another great option
is the Amazon EC2 Container Service, or ECS.
This service uses an analogous vocabulary
but with a slight different twist to each part.
Task definitions provide all the information required
to start a container and a set of containers
that are designed to run together.
It's somewhat analogous to a pod,
a little bit in Kubernetes,
it's all the information required for
services that will run together on the same machine.
It doesn't actually run anything,
creating a task definition
just defines a task that will run.
When a task definition is actually run,
it's called a task,
and that's a bunch of containers that are running
right now, shared together on a single host.
Services take tasks, expose them to the Net as a whole,
and ensure that they stay up all the time.
So, you'd create a service that has 14 copies
of a particular task,
and it will ensure that that many copies is running
all the time, even if it has to split it
across several hosts.
ECS has a bunch of advantages, too.
It ties into the existing Amazon infrastructure very well.
So, Amazon load balancers tie into ECS services
to make your traffic available to the Internet
using the existing systems.
You create your own instances in AWS.
You have lots of control over that.
And once you've got your instances running,
you run an agent on them
and cause them to join the cluster.
This is kinda cool
because you take the docker control socket,
pass it to the agent that you run in docker,
and that allows the agent to control the host
that it's running on.
Kind of a neat system that makes running EC2 clusters
very convenient from an operational perspective.
ECS provides a set of docker repos built in,
so you don't have to run your own repo.
ECS has them built in and they're made available
to the machines on ECS.
It's perfectly easy to run your own repo
along with ECS, you don't have to use the built-in one
if you already have your own.
Containers and tasks can be part of CloudFormation stacks,
which makes deployment along with other resources in AWS
very, very easy.
So, if you have containers that need to access to queues,
and they need access to EC2 volumes,
you can deploy all of this in one go
and have it be cleaned up together
when the service ends.
To get started with ECS,
head on over to the Amazon ECS product page
and click on Getting Started.
Other popular options include AWS Fargate from Amazon,
which is a more automated version of AWS ECS.
Docker Swarm from the people who make Docker.
Google offers its Kubernetes engine.
And Microsoft offers the Azure Kubernetes Service
for orchestrating your containers.