The course is part of these learning paths
This hands-on lecture will walk you through installing Docker on CentOS Linux using Vagrant. Additional documentation is available should you plan to install on a different OS.
It is highly recommended to remove any prior versions of Docker, as you will need to be sure you have a clean slate.
Next, you will install the yum-utils package including the yum-config-manager, the device-mapper, and lvm2 packages for the device-mapper storage driver.
You will use the yum-config-manager to add the Docker repo and eventually Docker.
After Docker has been installed, you will start up the Docker daemon. To verify that Docker is running properly, you will execute the hello-world container.
Welcome back! In this lesson we'll be installing Docker on CentOS Linux. I'll be using Vagrant to start up a CentOS VM. However, Docker has good documentation covering all of the different installation options available, and there are several operating systems that you can use. So if you wannna run Docker on Windows, macOS or Linux, there are instructions for that, and I'm going to leave the link to that documentation in the description of this course.
Now, I'm currently connected to the CentOS VM via SSH. The Docker documentation recommends that you start with a clean slate and remove any existing version of Docker. Now, this is a new VM. There isn't anything installed, so this shouldn't have anything that needs to be removed, but I'm going to run it anyway.
Great. Next up we need to install some prerequisites. The yum-utils package includes the yum-config-manager, which allows us to add and enable yum repositories. The device-mapper and lvm2 packages are used for the devicemapper storage driver. Now, this is only going to take a few moments. And there it is.
So with these installed, now we can use the yum-config-manager that allows us to add the Docker repo. Okay, with the Docker repo added, we can install Docker. And you can see here there is a summary of what's going to be installed. This is going to install nine dependencies and the total size will be 81 megabytes.
So let's say yes to this part. And there we go. Now it's going to ask to verify a couple of GPG keys, and this can be done by typing the letter Y. And once again. Okay, perfect. The next part is going to take a minute or so, so I'm going to speed this up. And we're back. Okay, everything went well, so the container engine should be all set.
Next let's start up the Docker daemon. And there it is. And it's returned with no error message. Now let's verify that the daemon is running with the status subcommand. So you can see here that the daemon is running. Now, in theory, everything should be working and ready to go. However, let's verify that, and to do that, we're going to actually start up a very simplistic hello-world container.
Now, I don't want you to worry. We haven't really covered containers yet. If this doesn't make sense, that's okay. We're going to cover that in the next lesson. So let's test this out by running Docker's hello-world image. Okay, there's a lot happening here in this output and we'll go through that later.
For now, I want you to focus on this "Hello from Docker" message. Now, seeing this means that Docker is working correctly because it was able to grab the image and then run a container based off of that and display the message. Okay, let's wrap up here. Docker is up and running on CentOS and we've verified that it is working.
So if you ran into any issues, what I want you to do is use Docker's documentation to kind of help work through them. With Docker running, you'll be ready to start using it for the rest of the course. So if you have it up and running and wanna start actually using it, then I'll see you in the next lesson.
About the Author
Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.