Docker is a popular containerization platform that simplifies the process of deploying applications in containers. Here’s the step by step process which shows how to install Docker on CentOS 7.
Updating System Packages
First, update your system’s packages:
sudo yum update -y
Installing Required Packages
Install necessary packages for Docker:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Setting up Docker Repository
Add the Docker repository to your system:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Installing Docker
Now, install Docker:
sudo yum install docker-ce docker-ce-cli containerd.io -y
Starting and Enabling Docker
Enable and start the Docker service:
sudo systemctl start docker sudo systemctl enable docker
Verifying Docker Installation
Check if Docker is running correctly:
sudo docker run hello-world
This command downloads a test image and runs it in a container.
Docker is now ready to containerize and manage your applications, providing a consistent environment for development, testing, and deployment.
Installing Docker Compose
Docker Compose is a tool for defining and running multi-container Docker applications.
Download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Check Docker Compose
Check the docker compose installation by viewing the version:
docker-compose --version
It enables the management of multi-container Docker applications with simple commands.