Installation of Docker in Centos
This blog will help you to install and understand docker on centos and mentioned steps will be helpful for your centos to update kernel version.
Below are the steps to install docker container and start working on it. As I have installed docker on Centos Server, below are the steps to install on it.
System Requirement
- 1) Kernel must be 3.10 or more then that.
- 2) device-mapper-libs must be installed on it.

Steps are as below
Step1: Install 3.0 or later version of kernel
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 10
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
Step2: Installation of Docker packge repository
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
Step3: Installation and Start docker service.
yum install docker-engine
service docker restart
you can check logs by executing below command
tail -f /var/log/docker
Now Press CTRL+C
Step4: Start your hello-word container.
docker run hello-world
docker ps -a
You will see there will be 1 container running on your server with named hello-world
Nginx Docker setup
# Pull the Nginx image
docker pull nginx
# Run Nginx container
docker run --name docker-nginx -p 80:80 nginx
# Create and navigate to HTML directory
mkdir -p ~/docker-nginx/html
cd ~/docker-nginx/html
vim index.html
# Check running containers
docker ps -a
# Stop and remove Nginx container
docker stop docker-nginx
docker ps -a
docker rm docker-nginx
# Run Nginx container with mounted volume
docker run --name docker-nginx -p 80:80 -d -v ~/docker-nginx/html:/usr/share/nginx/html nginx
# Attach to the running container
docker exec -i -t 2f9f1cacb645 /bin/bash
# Now, check the Nginx service inside the container
# Access it by browsing the host machine's IP