devops docker linuxIn a past episode, I tried to explain in simple words what Docker is, how does it work and why it’s good to start looking at it, if you missed my article, here is the link – Docker, nice to meet you!

Now that you are curious enough, it’s time to move a step forward and try to install it in your system. Due to the nature of the blog, I will mainly cover linux installation on different distributions, but I’ll give many information about how to install it on Windows too.

So..how to install docker on centOS-Fedora?

I suggest you to read my articles about packet managers if you don’t find any of the steps below 100% clear!

Even if they come from the same root (rhel), centOS and Fedora started to take different roads in the last years, and even the packet manager, so I will provide you a dual-command view for every step.

Install pre-requisites and add repository

Let’s install some dependencies in order to be able to add the repo and/or docker itself

centOS

Copy to Clipboard

We are now ready to add the repository:

Copy to Clipboard

Fedora

Copy to Clipboard

We are now ready to add the repository:

Copy to Clipboard

As you can see, the commands are very similar, since DNF is a nothing more than an improved version of YUM!

Let’s install and start Docker!

We are now ready to proceed in the installation step, let’s do it!

centOS

Copy to Clipboard

Fedora

Copy to Clipboard

The installation step doesn’t automatically starts docker, so we need to start it manually. Since systemctl is used in both distros, the command is unique.

Copy to Clipboard

Verify and run your first container

Now it’s time to verify that everything is ok, the command is the same for both distros, and so is the output:

Copy to Clipboard

If everything went right, the output should be similar to the one below:

Copy to Clipboard

Now it’s time to run your first container!

Let’s use the command docker run and let the magic happen!

Congrats! Your docker installation is up and running, check out my other tutorials to move your first steps!

Additional information can be found in the offical documentation: