In this article, we will have explained the necessary steps to install Docker on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Docker is a free and open-source containerization platform that allows you to quickly build, test and deploy applications as portable, self-sufficient containers that can virtually run everywhere. The containers are similar to a virtual machine but consume fewer resource, easy to manage and can run anywhere regardless of operating environment it is running in.
Install Docker on CentOS
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo yum install epel-release sudo yum update
Step 2. Intsall Docker on CentOS 7.
Add the repository to your system typing following in the terminal:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker typing following command:
sudo apt install docker-ce
Once the installation is completed the Docker service will start automatically:
sudo systemctl start docker sudo systemctl enable docker
You can check the Docker service status using the following systemctl command:
sudo systemctl status docker
The output should be similar to the following, showing that the service is active and running:
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2019-03-29 20:22:00 PDT; 8min ago Docs: https://docs.docker.com Main PID: 1946 (dockerd) Tasks: 26 CGroup: /system.slice/docker.service
To verify that Docker is installed, run the following command:
$ docker -v Docker version 18.09.0-ce, build 9ee9f40
Congratulation, you have learned how to install Docker on CentOS 7. If you have any question, please leave a comment below.