Saturday, April 23, 2016

Docker Terms

Docker Engine:- 
Sometimes called docker daemon or docker runtime. It gets downloaded from apt-get or yum in linux whenever we install docker. It is responsible for providing access to all documents runtime and services.

Images are what we launch docker containers from.
  docker run -it fedora /bin/bash  
In this example fedora is the image , it will launch fedora based container. Images comprises of different layers. Everytime we don't specify the image version it will pull the latest fedora version. For getting all the images use a -a flag in the docker pull command . For checking all the available images use
 docker images fedora  

Images have 5 fields associated with it.

Friday, April 22, 2016

Running docker on TCP

Docker container run as a unix socket which means it uses the UDP protocol which is not very reliable. If you want to run the docker on the TCP you can do it as follows:

 docker -H 10.X.X.X:2375 -d &;  

You can verify this by using the netstat command to verify if the docker is runnig on a tcp port

Granting normal users access on docker containers

Depending on your needs you might want to give normal users depending on there role to have permission so create docker containers. You don't want to go out giving sudo privileges to all users just to maintain the docker containers.

If you run the docker container you would receive an error stating permission denied as

To overcome this problem we are going to add the normal user under the docker group. This would enable them to create the docker containers. The docker group is created by default once you install the docker. You might want to restrict users who have the access on docker containers depending on you environment.

Stopping a virtual machine by vagrant

We have powered on the ubuntu and centos machine using the vagrant. You can power off the virtual machine using the halt command. You need to be in the path of the virtual machine to power it down. Use the following command to power down the virtual machine.

 vagrant halt  

You can confirm it from the Oracle Virtual Box also

Creating Centos Virtual machine using Vagrant

Creating a centos6.5 virtual machine using vagrant as follows

1. Add the Centos Image to  the folder as follows

 vagrant box add centos65-x86_64-20140116 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box  

2. You need to initiate this virtual machine as follows and than start it

 vagrant initi centos65-x86_64-20140116  
 vagrant up

3. Details of the Virtual machine and authentication details can be found as follows

 vagrant ssh-config  

Thursday, April 21, 2016

Docker Installation

We are going to install the Docker on the Ubuntu machine which we already created  in our previous posts using the Vagrant, check it out here.

You need to have sudo privileges on the machine to install Docker. We are simply installing the docker using the root in our example. You can do the same or use sudo to achieve the same.

Make sure you are running kernel version 3.10 or higher while running Docker because it gives better performance and support kernel spaces and that kind of stuff.

For installing the docker on ubuntu we are going to use the apt-get and run the following command.

 apt-get install docker.io  

That's it docker installation is complete.

You can check if the docker service is running on the ubuntu machine or not as follows

Using Vagrant to run the Ubuntu Machine

Vagrant is particularly helpful in automating the virtual machine setup so that you can create the virtual machine much easily and start using them instead of doing step by step installation of the same. Vagrant using the prebuilt images and would download that automatically as you start off the virtual machine.

1. As a pre-requisite you need to have Oracle Virtual Box which actually runs the virtual machine. You can download the latest virtual box here.

2. You need to download and install the Vagrant. Vagrant can be downloaded here.

Once you have installed the Virtual box and Vagrant, its a matter of few commands to spin up a new Virtual Machine.

Open the windows command line using the cmd in search option.

Create a new folder as C:\vm\test to use it for creating your first virtual machine using Vagrant.

Navigate to that folder in the command line panel

You need to do initiation of the image being used by vagrant. Simply type following command

 vagrant init ubuntu/trusty64 
 vagrant up 

Saturday, April 16, 2016

Apache Kafka Introduction


Apache Kafka is a distributed publish-subscribe messaging system.
Originally developed at linkedin and later become part of apache project.
Apache kafka is written in scala.

Kafka is fast, scalable, durable and distributed by design which means it can run as a cluster on the different nodes. Kafka has a very high throughput. With high throughput means that it can process billions of messages per day with low latency and in near real time activity from different systems together through different topics and queues.