Docker is a tool that allows you to easily build, test, and deploy applications smoothly and quickly using containers. It has gained widespread popularity in recent times due to the portability to run applications anywhere irrespective of the host operating system.
Let's get started on how to install Docker on CentOS / RHEL. 🚀
Docker is available in two editions, namely,
- Community Edition (CE)
- Enterprise Edition (EE)
Here, we will install Docker Comunity Edition (CE).
Prerequisites
Uninstall older versions of Dockers, named docker
or docker-engine
along with associated dependencies.
$ yum -y install lvm2 device-mapper device-mapper-persistent-data device-mapper-event device-mapper-libs device-mapper-event-libs
Add Docker Repository
Now let’s add the CE repository for the Docker installation.
$ curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
Install Docker CE
$ yum install docker-ce
Output
Error:
Problem: package docker-ce-3:19.03.5-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
- cannot install the best candidate for the job
- package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
- package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
- package containerd.io-1.2.2-3.el7.x86_64 is excluded
- package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
Install the Docker CE by skipping unavailable package
$ yum -y install docker-ce --nobest
Now you have Docker installed onto your machine, start the Docker service in case if it is not started automatically after the installation run these commands.
$ systemctl start docker
$ systemctl enable docker
Verify Docker Installation
$ docker run hello-world
And it's done! You have successfully installed docker on your RHEL / CentOS. Happy Learning! 🎉
Top comments (0)