Installing docker with ubuntu 16. 04 lts, mint 17 and centos 7

Installing docker with Ubuntu 16.04 LTS, Mint 17 and CentOS 7

Installing docker with Ubuntu 16.04 LTS, Mint 17 and CentOS 7

A brief introduction to virtualization

Today we will learn installing docker with Ubuntu, mint and CentOS 7 Linux,  Before the evolution of the concept of virtualization, to run one application one dedicated server was required,  if you wanted to  run 20 application like mail server DNS services, web server or something else, you were required to buy 20 dedicated servers, every application hardly consuming 5-10% of total CPU capacity, therefore, it was a total wastage of resources. To get rid of such wastage of resources concept of virtualization was introduced, where hypervisors built a layer on hardware where multiple virtual machines can be installed and they behave and taste like real independent servers. This virtualization concept was a revolution in resource utilization and cost cutting process.

A
Sponsored
brief introduction to containers

Although hypervisor-based virtualization was a game changer, but soon It was realized that there are certain issues even with that hypervisor virtualization concept, no doubt we were able to run multiple operating systems on single CPU, but still there was the need of multiple OS for multiple services and not all of the operating systems were free to form License they still required to get purchased, additionally every virtual OS consumes huge amount of CPU, hard disk, and RAM. To overcome that resources thirsty hypervisor problem, a new concept of Operation system level virtualization was introduced.

We can consider containers as tiny capsules which have their own individual operating environment which shares kernel of parent operating system and these containers  will behave like some independent operating system, they will be having their own root directory and other file systems, networking properties and processes like init or systemd, they have their own process hierarchy and process running in one container cannot send signals to another process running in a separate container and run their applications independently just like they were running in hypervisor-based virtual environment,  We can state containerization as “Operating system level virtualization”, CPU is installed directly on CPU, and kernel  resources  of parent operating system are shared by userspace instances. All containers share CPU resources but their boundaries are defined via kernel namespace, partitions are defined for every container so that they can use resources, libraries within their boundaries. Another important feature of containers is cgroup or control group which can group processes of containers and can define what percentage these process group can consumer, this percentage of resource sharing is quite flexible and can be decrease or increase as and when required.

See also  Meet the Canonical Federal and DOD team at Alamo Ace 2023

A Brief history of Docker

Docker is container runtime and also a company, it combine all capabilities of container and form a product, formally it was an internal project of  dotClous company which is providing Platform as a service, it was started by Solomon Hykes in France, you can say he is Father of Docker, docker is written in Google go language, it was first released in March 2013 with a version of 0.9. Docker is licensed as open source. Initially, docker was based on LXC containers but some issue arises like they cannot control LXC development.  So they write a new driver resource which is called libcontainer. it got popular very soon, more than 17000 developers are contributing to docker which is increasing by 200 to 300 users per month, more than thousand of the applications supports docker, Red Hat, IBM, Cisco etc are the major contributor to docker, it has over 2600 GitHub stars and 20th most stared GitHub project. Chef, puppet or open stalk supports docker additionally AWS, rackspace, azure cloud services provide support for docker. Docker is providing training, documentations, and support.

Installing docker with Ubuntu 16.04

We have a fresh Ubuntu 16.04 OS installed, update system first

# apt-get update

Installing docker is pretty easy task, run command

# apt-get install docker.io

 

After installation, verify status of docker service

# /etc/init.d/docker status

 

Verify docker version

# docker version

 

Enable to run docker on boot time

# update-rc.d docker defaults

Download ubuntu docker container

# docker pull ubuntu

 

See also  Ubuntu Weekly Newsletter Issue 809

Verify downloaded Ubuntu  container

# docker images

 

To enter to that Ubuntu container give following command and you will be automatically in, -i  option will make it interactive and -t will assign tty to container.

# docker run -i -t ubuntu

To exit from container, type exit.

Search for CentOS container

# docker search centos

 

Centos is not installed, let us  try to run that container, you can notice that it will start installing centos image

# docker run -it centos /bin/bash

 

List installed images again!

 

If you wants to exit from container without killing it, press Ctrl+P+Q, you will exit from container without stopping it, run following command and you can see that container is still up after exiting with Ctrl+P+Q.

# docker ps

Sponsored

Installing Docker with CentOS 7

Installing docker with CentOS 7 is not so different than it was in Ubuntu 16.04, install a fresh version of CentOS and update

# yum update

Install docker

# yum install docker

 

Check docker version when it is installed, you can notice that docker version is different then docker installed in Ubuntu

 

Pull fedroa image for docker

 

Let us do some tasks with installer fedora container

Install  apache under fedora container using dnf command

 

You can notice that fedora commands are working perfectly under CentOS 7 environment.

Check kernel version inside fedora container, centos 7 kernel can be noticed which means that we are sharing kernel userspace of CentOS.

 

Now verify installed operating system
It is clear that we are sharing centos kernel but running independent fedora container.

Installing Docker with Mint 17 Linux

Add repo to APT source

# sudo echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list

Import Key

# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Update system

# apt-get update

Install docker

# apt-get install docker.io

When i tried to grab an image of centos get following error.

<strong># docker pull centos </strong>
FATA[0000] Post http:///var/run/docker.sock/v1.18/images/create?fromImage=centos%3Alatest: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

To resolve this error we need to add our user to docker group

# sudo usermod -a -G docker $USER

Docker is working now, pull Ubuntu image

 

What is the future of docker project?

Definitely docker is eliminating hyperversor based virtualiztion very frequently, in future CPU manufactures will start providing chip level assistance for containers and they will start coming as embedded support, chip level support will make os level virtualization more secure and more efficient, there a possibility that several containers will be available that will compliment each other and they will be able to communicate with each other in the form of a single application, this will be more independent and modular concept of application development. There is also another possibility that no huge processing will be required for SMBs because of docker based applications will be working even on small hardware configurations which no doubt will increase the role of raspberrypi type of Linux embedded hardware. Have Fun!!

The post Installing docker with Ubuntu 16.04 LTS, Mint 17 and CentOS 7 appeared first on NixPal.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply