In the last years there is nearly now other technology that is as popular as docker. On nearly every conference there is a docker related topic. But what is docker and why is it that popular?
Some year ago web and IT-procects were simpler and the requirements could be resolved with a few simple components e.g. with a LAMP-Stack (Linux, Apache, MySQL, PHP). When a developer what's to add a new feature, he builds his local development environment and installs all required components. Since he needed only a few, that effort for that was acceptable. Short downtimes for deployments were also acceptable since we were not used to the fact, that everything is allways online.
The times have change. Onlineshops like Amazon or the Google Search have raised exceptations of the user. Everybody expects that everything is online and working everytime. At the same time more and more complex features are expected and a website needs more components to run e.g:
More complex requirements means more complex projects. Changes should be applied tested and continously and the peformance should scale when the amount of users increases.
All these facts are a challenge for the development since a manual setup would take longer and longer. Manual deployments with more and more services are also more error-prone.
Also others have seen theses changes and solved them e.g. with virtualboxes and vagrant. A developer could download a preconfigured box to get his development instance with the latest development state running in a few minutes. With techniques like ansible or chef the infrastructure can be desribed as code and a plain linux system can be provisioned into a projectspecific instance with all services.
A vagrant box is a virtual machine, this means that the guestsystem thinks to run on a certain simulated environment. The advantage of this approach is that a project can be splitten into one or many virtual machines and it is logically encapsulated from the rest of the system and other projects.
The usage of a vagrant box offers the following advantages:
But using vagrant boxes has also disadvantages:
Docker uses a new abstraction. They use a common term from the transport business called "container". But which advantages does containers have?:
What would happen if we could se a service in our project as a container? A container has an interface to the outside and we do not need to take case of the content, aslong as it does what it should do. If we need more power for one service, we just use more containers...
This is the concept of docker. The interfaces a ports. A container exposes ports to the outer world. Behind these ports there are running services.
Compared to virtualbox, a container is NOT a virtual machine. I runs with the same kernel as the host system but is isolated from other processes.
A docker image is described with a Dockerfile. The structure of a Dockerfile is simple. The following example shows the dockerfile for a Tika Server from Logicalspark:
The described structure and concept of docker have the following advantages:
You now did the first steps with Docker. In one of our next blog posts we will show, how you can build an image form a Dockerfile and create a container from an image.