Docker @ Innoraft
2016 14 May

Docker @ Innoraft

By Gaurav Goyal

My previous blog How I Started Docker was about my first encounter about Drupal. After that we all started playing with Docker and soon we adopted the technology with full force in our development workflow.

In this blog I’ll be sharing my experience on how we can dockerize our drupal setups.

Docker

“Develop, Ship and Run Any Application, Anywhere”

While working with Docker, I came up with my own definition for ease of understanding. Docker is a service which allows you to use multiple and diverse services of same type on the same machine, typical stuff isn’t it?? Umm .. In simple words, with docker you can run different web servers simultaneously which means at the same time you can run your Nginx server for one application and apache2 server for another application on the port 80 itself.

Why we chose Docker

Below are some of the reasons why Docker is the right choice for you:

  1. Whenever we deploy on our dev servers, most of the time we used to scream, “What just happened? It was working perfectly fine on my local. Why isn't it working on Dev?”.

  2. Our local environment and our dev, stage environments usually have different configurations in terms of server, for e.g., if I am using a machine, which is 3 years old, so there is a good chance that I have some old version of PHP, apache2 etc. More often than not we end up in a situation of different versions of different services in different environments which is not healthy for deployments.

  3. Difficulty in the deployment of server related changes.

  4. We were failing in updating the projects i.e. my local has 4 different projects and all support say php 5.3.3 version, now client asked us to update the php version of two of the projects. It was very very difficult to maintain different versions of the same service on same machine i.e. on local.

  5. We were not able to experiments with different services of the same type.

...there are more reasons but the above ones are most commonly faced.

Docker in Innoraft

Docker at rescue

Answers to all our problems were to isolate the services and be able to seamlessly communicate with each other and that’s where Docker came into action.

Concept

Docker allows you to package an application with all of its dependencies into a standardized unit for software development. We create images of different services - say, you have one image for apache, one image of mysql and etc. With the help of these images, we launch containers.Containers are analogous to VMs but they are way lighter.

Terminology

  1. Containers:- Containers are basically a setup of services with only the required things. For e.g., for you, web server all you need is an OS, and Apache2 with required modules. We don’t even want a text editor for running a web server. So your container will have a very light setup of OS, say Ubuntu, and your web server will be installed on this OS.
     

  2. Images:- Images are the prototype of containers. Containers are launched from the images. With images, you can create base images and can reuse them. Say, you have created a base image of Ubuntu, now this image can be used to create other images. For e.g., you have to create two different containers i.e. one for the web server and other is for the database server.

How images are used:

  1. Create an image for your base OS
    1. Install OS

  2. Create an image for Apache server

    1. Use above-created image, and install the Apache server on top of it.

  3. Create an image for database server

    1. Use the previously created image, and install the database server on top of it.

This is again an explanation to the basic Docker concepts. In the next post, I will be talking about the full process of building docker images and using them for your projects.

Featured blog

web-personalization

Personalized Content is a Proven Entity !!

Irrespective of how big a business icon or brand you are, increasing the relevance of your website will always be critical to your success.

Read More

Git Hooks

Git hooks for better codes

We are programmers and we are always on the lookout for ways to improve our code. A good and structured way of coding defines the completeness of a programmer.

Read More

Drupal ,varnish cache

Hard time with Drupal, Varnish Cache and Cookies

Using a reverse proxy server in front of a web server is usually needed for every big site and it is a very good thing to do so as reverse proxy server will handle all the anonymous traff

Read More

Say no to captcha

Say no to captcha - Various Spam Protection Methods

Maintaining high traffic websites have their own merits and demerits, the most annoying thing about them is SPAM.

Read More