- [Instructor] Docker is compatible with a number
of different Linux distributions,
including Ubuntu, Debian, CentOS,
Fedora, and others.
We're going go deploy Docker CE into a virtual machine
that's running Ubuntu.
Now before you do so,
you want to make sure that you have the 64 bit version
of Ubuntu already installed and connected
to your network with internet access.
I recommend consulting the Docker documentation
for the latest instructions
as these instructions can change
as newer versions of Docker are released
and the installation instructions can vary slightly
between Docker CE and Docker EE.
Now the general steps to install Docker on Linux
are first, to uninstall Docker
to make sure that you don't have
a previous version of Docker.
Make modifications to the Linux package installer
called APT, to add the Docker repository,
then update your packages, install Docker, and verify.
The first step that we're going to perform
is to uninstall Docker.
And I should point out that all the commands
that we'll be covering in this lesson
will be available in your course resources.
So we're going to run the command
sudo apt-get remove docker docker-engine docker-ce
and docker.io.
I'll put in my sudo password,
and it verifies that none of these packages
are already installed.
The next step that we're going to perform
is to update our packages.
We want to make sure that have the latest
and greatest package index of what we can possibly install.
We don't want to install, accidentally,
any older versions of software.
To do this, we'll run a sudo apt-get update,
and this pulls down the index of all the latest
Ubuntu packages.
With our package list updated,
the next step is to allow the APT package tool
to use a repository over HTTPS.
This is kind of a long command here
in multiple lines.
That's hat the back slash does
is it allows you to put the same command
into multiple lines.
So if we paste this command in, sudo apt-get install
apt-transport-https
ca-certificates, curl,
and the software-properties-common.
We'll say yes to install these packages,
and the packages are installed.
All right the next step is to add Docker's official
GPG key to APT.
This is so that the APT package tool
knows how to recognize the official Docker website.
Let's clear the screen, and we'll paste this command in.
It's a curl command that pulls down the GPG key,
and then adds the key using apt-key.
We get the response there of OK,
so we know that this was successful.
And then from here we'll verify that we have
the official Docker GPG key
using the apt-key fingerprint command.
We'll paste that in,
and we get the official response from Docker.
We can see the UID of the Docker release.
Everything looks good.
Moving on to the next step,
we're going to add the Docker repository
to the APT package tool.
We'll paste this command in.
Ti does an apt-add-repository
for download.docker.com/linux/ubuntu
for the stable release.
And with that repository added,
we're going to do an apt-get update again
to download the latest package index
now that we have the Docker repository
added to our list of repositories.
I'll paste that in.
Again, apt-get update.
And we can see in the list there
that we did indeed download the package list
from download.docker.com.
And now an exciting step here.
We're going to do an apt-get install
and install Docker CE.
In this case, we're going to specify
a specific version of Docker CE.
If you didn't want to specify a specific version
and just get the latest stable version,
you could just do an apt-get install docker-ce.
We've added on the equals here
to specify the specific version of Docker CE
for Ubuntu that we'd like to run.
I'll clear the screen before I do this
and paste in this command.
Sudo apt-get install docker-ce.
It found that version.
We'll say yes here.
We are unpacking Docker,
setting up Docker,
and Docker should be installed,
but let's do a little bit of verification.
Now before we verify, we're going to make sure
that the Docker group is added.
We're going to add our user account to that Docker group,
and then log out and log back in
for this to take effect.
The groupadd command tells us tat the Docker group
already exists, and then we added our user account
to that Docker group.
Let's exit out and log back in.
All right we're logged back in,
and now let's verify that Docker was successfully installed.
To do that, we'll do a docker version
and a docker run hello-world.
So docker version tells us we do indeed have
version 17.12.0 Docker CE successfully installed
at both the client and on the server.
If we clear the screen, let's do a docker run hello-world
to run our first container,
and make sure that Docker's actually working.
It pulls down the hello world container
and there we go, it says hello from Docker.
This message shows that your installation
appears to be working correctly.
And with that, we have successfully installed
Docker on Linux.
Thanks for watching.