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.
rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
yum -y –enablerepo=elrepo-kernel install kernel-lt
yum -y install device-mapper-libs
vim /etc/grub.conf and chnage default kernel to 0
reboot
uname -a
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:
docker pull nginx
docker run –name docker-nginx -p 80:80 nginx
mkdir -p ~/docker-nginx/html
cd ~/docker-nginx/html
vim index.html
docker ps -a
docker stop docker-nginx
docker ps -a
docker rm docker-nginx
docker run –name docker-nginx -p 80:80 -d -v ~/docker-nginx/html:/usr/share/nginx/html nginx
Login to docker on bash shell:
docker exec -i -t 2f9f1cacb645 /bin/bash
Now you can check nginx service is running on it.