- [Instructor] In Docker's forum, there are two
different types of services that you can deploy.
We've been deploying replicated services,
which are the default type of service in Docker's forum.
With replicated services, you deploy, for example,
a web server and all those web servers
are going to have the exact same content, exact same code,
and you tell Docker's forum that you want,
perhaps, 10 of those web servers
and it's just going to figure out where to run them.
Some nodes might have five, other nodes might have none.
It's all up to Docker's forum.
On the other hand, you can deploy
a global service in Docker's forum.
With a global service, it will run exactly one task,
which is typically one container,
on every single node in the cluster.
There's no set number of replicas,
it's just going to run one on every single cluster.
This is really good for monitoring agents
or virus scanners, things like that.
When you deploy a Docker's forum service, you can configure
the mode of the service that you're deploying.
If we look at the Docker service create command,
scroll down here, there is an option
called --mode and this is where you can define
that service to be either replicated or global.
Let's go over to the command line
and I'll show you how to deploy a global service.
We're going to run docker service create,
we'll do --mode and we'll specify that we want
to configure this service to be in global mode.
From there, let's give this service a name,
we'll call it global-service and then we'll specify
the name of the image that we want to run.
All right, our new global service has been deployed.
Let's do a docker service ls and there's the global service.
You can see under replicas, it says three of three,
but yet we didn't define the number of replicas at all.
It chose three replicas because we have exactly three nodes
in our Docker's forum cluster and as a global service,
it deployed one task, which in this case was one container,
across each of the different nodes.
That's the difference between a global
and a replicated service in Docker's forum.