Hi hope you are doing well, lets learn about “How to Setup and Install Docker on CentOS 7 Linux”, the Docker is the fastest growing technology in the IT market.
Many industries are moving towards docker from the normal EC2 instances. Docker is the container technology.
It is PAAS (Platform as a Service), which uses a OS virtualisation to deliver software in packages called containers.
The containers are the bundle of the packages, library files, and some configuration files. It was first started in 2013 and developed by Docker, Inc.
So lets have the Setup of Docker CE on CentOS 7 Step by Step Guide.
Setup and Install Docker CE on CentOS 7
STEP 1: Update the Repository for the Docker to setup and Install on CentOS 7.
Let’s Install the package yum utils first on the CentOS 7 server and update the repository, repo with the yum command.
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
So the above command will add the repo for Docker into CentOS 7.
$ sudo yum update
yum update command will update the repository and then we will proceed with the installation guide.
STEP 2: Setup and Install Docker CE on CentOS 7 via yum command.
$ sudo yum install docker-ce docker-ce-cli containerd.io -y
Once the docker installation get’s completed , start the services for the docker and enable it after rebooting the System.
$ sudo systemctl start docker
$ sudo systemctl status docker
So we have check the status for docker, and it is active running on the CentOS 7, so enable the service for docker at the time of booting.
$ sudo systemctl enable docker
STEP 3: Add the User in Docker Group.
Now lets add user “tastethelinux” into the docker group.
sudo usermod -aG docker $USER
“$USER” is the username tastethelinux, you can use whoami to check the username.
Docker version 20.10.8, build 3967b7d
So then check version using docker command without sudo, you will get the version for the docker.
So we have successfully install docker ce on CentOS 7, lets create a Container for the MongoDB.
STEP 4: Test Docker by Pulling Images.
So here we will create a container for MongoDB on docker, let’s use the pull command to pull the MongoDB image first.
$ docker pull mongo
So we have pulled the images for mongo from the docker, Once it’s completed you can check the image by using “docker images”.
$ docker images
STEP 5: Run Docker Container in CentOS 7.
Now let’s run the docker container by using docker run command.
$ docker run -d mongo
So we have successfully run the docker container in CentOS 7 for MongoDB, now if we have to verify the container is running or not use “docker ps” command.
$ docker ps
So we have install Docker CE in CentOS 7, then run the container for MongoDB server on CentOS 7.
If you want to install MongoDB on EC2 instances follow the link, Install Docker on CentOS 8, Want to Install Docker CE on Rocky linux 8, Install Docker Compose on Rocky Linux 8. Thanks to Read the article. Keep Supporting US.
One Reply to “How to Install Docker on CentOS 7 Linux.”