- [Instructor] An easy way to get started with Docker
running on a production grade server
is to run it in Amazon Web Services.
Let's go ahead and deploy Docker's Community Edition
on CentOS in Amazon Web Services.
We're here in the AWS console.
I'm just going to click launch instance
and then from the AWS marketplace
let's type in CentOS.
I'll take the first image that comes up here.
This is a free tier eligible image and I'll click Select.
We can take all the defaults here
because we're deploying Docker Community Edition
just for testing, learning, and training.
So the resource requirements are very, very small.
Of course, if we were deploying Docker
for production applications
we would want to carefully consider the sizing
of the hardware resources.
I'll click Review and Launch.
Take the default and click Launch.
Now we'll need to create a new key pair
if you don't have one already.
I'll just call this pair linkedin
and click Download Key Pair.
With that key pair downloaded, I'll click Launch Instance.
And we'll give it a moment to launch our new
CentOS instance in AWS.
It says your instances are now launching.
Let's check on the status of those.
And it looks like the new instance is running.
I'll click Connect
an notice here that we need to carefully set the permissions
on the SSH key that we downloaded
by using a change mod 400
and then we can we connect to this new server
using this SSH string.
I'll just copy that.
We'll click close and then go over to our terminal.
And then here at the command line,
if I go into the downloads folder
you can see there's the new key that we've downloaded.
Let's do a change mod 400 on that key.
We set the permissions correctly.
Let's clear the screen.
And now let's paste in that SSH command line string
to connect to the new CentOS host.
It looks like there was a little issue
with the command line string that AWS gave us.
It tells us instead we need to be connecting
with the CentOS account.
That's not a problem, we'll just change that here
and we successfully connected to our new CentOS instance
running in AWS.
So now let's deploy Docker Community Edition
on CentOS in AWS.
To do that, let's check out the Docker documentation.
Docker has specific instructions
for each of the different Linux distributions
that it supports.
Here in the Docker documentation,
you'll find instructions for each of those different
Linux distributions.
If we scroll down here on the instructions
for installing Docker CE on CentOS,
the first thing that it recommends
is that we make sure that we uninstall
any previous editions of Docker.
We'll copy that command string and paste it in.
And as you can see,
there were no previous editions of Docker.
So that's good news.
We can get started with the installation
of Docker Community Edition.
The first step is to install a few packages
that Docker will need.
The device mapper, specifically,
as well as as the yum utilities.
We'll paste that command string in
and we successfully deployed device mapper.
The next step here is to add the docker-ce.repo
to the yum package manager.
That was successful.
Now we can move onto the next step,
which is to do a yum install dash docker-ce.
So let's clear the screen
and we'll do a sudo yum install docker-ce.
Looks like we are successfully deploying Docker.
We'll say yes to confirmations.
And the installation was completed and successful.
Let's clear the screen
and the next thing we need to do in CentOS
is specifically to start Docker.
That's done using the systemctl start docker command.
So this will start the Docker daemon for us
and then we can test that Docker was installed successfully
using the docker run hello world command.
This pulls down the hello world image from the Docker hub
and we get a hello from Docker message
that tells us some of the next steps
we can consider when it comes to running
and using Docker in CentOS.
Now back here in the Docker documentation,
if you scroll down to the bottom.
There are some post-installation steps for Linux,
which I recommend.
For example, doing a groupadd docker,
which tells us the group already exists,
and then doing a usermod to add our current user,
in this case it's the CentOS user,
to the Docker group.
What this allows us to do is run Docker commands
without having to use the sudo command.
So we don't have to have special privileges
to run all the Docker commands.
This user, the CentOS user,
is now allowed to do things like docker run hello-world.
Uh oh, what's wrong here?
What did we forget?
There is an additional step.
You do need to logout and log back in
before those changes can take effect.
There we go.
We successfully deployed Docker Community Edition
on CentOS running in Amazon Web Services.
So that's how it works for Docker CE on AWS,
but what if you want to run Docker EE
or the Enterprise Edition on AWS.
Back here in the Docker documentation,
they have a section on Docker for AWS specifically.
And this covers specifically the Enterprise Edition.
In here they talk about deploying
Docker Enterprise Edition on AWS.
They talk about the supported editions
and there's a link here
that brings us to the Docker store
where they cover Docker Enterprise Edition for AWS
and if we click on EE Basic or EE Standard Advanced here,
that brings us to the AWS marketplace,
where they already have Docker EE for AWS
in the market place.
You can simply click here to subscribe
and then pay to use Docker EE for AWS by the hour.
So that's how you deploy Docker Community Edition
and Enterprise Edition on AWS.