- [Male Narrator] Perhaps you do it
first thing in the morning to see what's going on
with your Docker infrastructure
or perhaps something unexpected happens in Docker
and you need to know what's going on fast.
Either way, you've got to know how to
check the status of Docker.
So the first command that you absolutely must know
is the Docker version command.
So if we run Docker version,
this shows us one, that we can communicate with the server,
that's important because if you run Docker version
and you get an error, that means that your Docker client
can't talk to the server and that's important.
The server could be down or you just may not be able
to communicate with it.
So the Docker version command tells us
what version of the client we have
and what version of the server we have.
So, this tells us that that Docker's working
and it tells us what version we have
and what operating system we're running Docker on right now.
Another command to know to check the status of Docker
is Docker info and this command tells us a lot.
You might want to pipe it to more in fact.
But, if we scroll up a little bit here,
we can see that Docker info tells us very quickly
how many containers we have on our host,
how many containers are running,
how many containers are stopped,
the version of the server that we're using,
our storage driver, logging driver,
whether or not swarm is active,
so whether or not our cluster is active,
that's important to know,
and a number of other things, for example
the operating system that we're running Docker on,
the amount of CPU and memory on this Docker host,
the name of the Docker host and so forth.
Another important command to know when it comes to
checking the status of Docker is Docker PS.
Docker PS shows us exactly which containers
are currently running on this host,
how long they've been up, and what the status
of those containers are.
If you do a Docker PS minus A, that'll show you
not just the containers that are running,
but also the containers that have exited,
or shut down, and that's important to know
because you may be having a problem with a container
that's crashing or closing for some unexpected reason.
So, Docker PS shows you the status of the containers
running on your host.
So, let's clear the screen, and then the final command
that I want to show you when it comes to checking the status
of Docker is Docker node space LS
and we get an error message from this
and this is actually interesting because what this tells us
is that this must be a worker node,
meaning this is not a manager.
You can only run the Docker node LS command
and get a valid response if you're running
Docker node LS on a manager.
So let's go over to a Docker manager.
Here we are on a Docker manager in the swarm cluster
and if we do a docker node space LS here, very nice.
We get the status of our Docker swarm cluster.
So, here we can see we have two hosts
that are part of the cluster.
We get their host names.
We can see the status is ready.
They are active and available and this host
is the leader of the swarm cluster.
So, between the managers that are in the cluster,
this host is actually the leader.
It's making all of the decisions in the cluster.
So that tells us that things are good
in our Docker swarm cluster.
So that's how you check the status of what's going on
in your Docker infrastructure.