Docker @ Innoraft | Innoraft Skip to main content

Search

14 May, 2016
2 min read

Docker @ Innoraft

Image
Docker @ Innoraft - Banner

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 the 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 the 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 the 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 webserver 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 the above-created image, and install the Apache server on top of it.

  3. Create an image for the database server

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

This is again an explanation for 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.