And look at this, a big, warm welcome to our first demonstration.
I'm using the term demonstration lightly because it really is
encouraging you to follow along so you can get that great and
really required hands‑on experience.
But anyway, what are we going to be doing?
We're going to be taking a look at the Ubuntu 20.04 system,
and we're going to ensure that Docker is installed.
Now I'm using the word ensure here because if you've done the previous module,
you may well have Docker installed because we installed it using Terraform.
But in any case, if you haven't got it installed, we will install it.
My system is starting again afresh, so it's all clean and tidy.
Once we've got Docker installed,
we can test that Docker is working by making use of our hello‑world image.
Are you ready?
Then let's find that command line.
And look at this, the glorious command line,
and the command line where we're going to begin learning Docker.
To begin with though,
we're going to gain administrative privileges with an interactive shell,
so sudo ‑i.
Once we've got our administrative privileges,
we can clear our screen, and we can begin by taking a look at our IP interfaces,
so ip link show, and we can see that we've got three interfaces,
the local or LOOPBACK interface, emp0s3,
and emp0s8.
This is the way I've configured my virtual machine with Vagrant and will
be the same if you're using the same Vagrant file.
We're looking at that because when we install Docker,
we're going to get an extra bridge interface.
But before we install, we know on an Ubuntu‑based system,
we're going to use the apt update command to make sure
that our package cache is up to date.
And as we go through,
we can see now that we've got all of the information about
what is available in our repositories.
We're ready to begin our journey in installing Docker,
and it's not difficult, is it?
Apt install ‑y and then docker.io.
Don't just install Docker, it's the docker.io package that we want.
So we do need to get the package name correct in this case,
Docker is a completely different package.
But allowing this then to run through,
we can see that we're bringing down the package and any of its dependencies.
It will install Docker, and Docker runs as a service.
So we will be starting our service and enabling our service,
and that means that each time that the system starts,
we're going to be starting in the background Docker service.
So we can see it's just processing information at the moment. And we'll
leave it running in real time, so you know that we're not cutting
anything out. And it doesn't take long to install,
but as always, it's one of those watched kettle syndrome.
There you go.
It's installed.
Now, we can go through and take a look at our good old friend systemctl.
Running this is root.
When we run the status command,
we are also going to be able to see the log information and we can see
then the information that was logged during the startup,
part of which we can see is cut off a little bit,
but the default bridge is being created.
We're going to be able to see that when we go back out to our command line,
and we're going to be able to take a look at that
through our ip link command again.
So if I go back and run this now, the ip link and show,
we can see now I've got four numbered interfaces with
docker0 being the last interface,
which is a bridging interface that's been created by Docker.
If I go through and check the version of Docker,
we can see the version that we are using,
but we can get more information than that by using docker and info.
So this is a subcommand, there's no ‑‑ in front of it.
So you can see there we've got a lot of information coming back.
We can, of course, use all of this information if we need,
but scrolling back towards the top, we can see that we don't have any containers,
containers are runtime instances of images,
and we don't have any images.
We're going to change that.
And we can do that by using the docker command, run, and then hello‑world.
Run is used to create an instance of an image,
and we're saying create an instance of the hello‑world image.
The hello‑world image was going to be located in the Docker registry.
We'll talk more about this later,
but we're not going to find it locally so we're going to
pull it down from the hub.docker.com.
And that's exactly what it's telling me that you can't find it locally.
I pulled it out, it's really tiny, so it comes down really,
really quickly, and it does display then hello‑world,
Hello from Docker,
and gives me a little bit of information about what actually happened.
But there you go.
We've proven that Docker is up and running.
And we go back to our docker info, but rather than scrolling up,
we can choose just to display the top information,
so let's say that top 20 lines, and we can see now that we've got one container,
but it's actually stopped.
It started very quickly and stopped.
And, of course, we've got one image.
We can see that a little bit more by using our docker and ps.
This is listing our running containers.
If we want to see all containers, ‑a,
we can see then that we had our hello‑world image was created
into a container and that exited 47 seconds ago.
So it was running for about a second.
We can also choose to go ahead and list our Docker images,
and we can see that we've got the one image,
the hello‑world image, and look at the size,
how tiny it is, 13.3 KB, and it was last updated 8 months ago.
So this is the very basis of getting Docker up and running, and I hope it's giving you a little bit of an insight.