Docker is a product developed by the company of the same name. Originally developed by a French engineer, Solomon Hykes, the product was unveiled in March 2013. Since then, Docker has become THE fashionable app! We will see what it serves and how you can use it on a daily basis.
What is Docker?
Docker makes it possible to create environments (called containers) so as to isolate applications. Until then, I have remained very pragmatic... Docker relies on Linux kernel and on a feature: the containers, which you may already know under the sweet name of LXC. The idea is to run code (or run a task, if you prefer) in an isolated environment. I will stop here for the details of the Linux containers, instead focusing on the features highlighted by Docker. Finally, a third component is required, cgroups which will aim to manage resources (use of RAM, CPU among others).
Docker makes it possible to create environments (called containers) so as to isolate applications.
Docker, isolate an environment? Like a VM?
Yes and no! Docker and Linux containers do not behave in the same way as a VM. A virtual machine isolates an entire system (its OS) and has its own resources.
Launching an environment, and isolating the components of this container with the components of my host, this is what Docker knows how to do! It does it very well and remains an alternative much better than the VMs (for equivalent use).
Schema realized by Docker themselves.
Docker, only on Linux?
Lets discussed the compatibility between Windows and Docker. I already see the heads of some who are not convinced. Maybe you've already tried it or used it through Windows or MacOS. However, Docker can work only with the presence of Kernel Linux!
In spite of not excluding developers working on a platform other than Linux, VMs (yes this time we talk about real virtual machines) have been put in place. The best known is boot2docker. It relies on a VM VirtualBox. This virtual machine contains a Linux which will then be able to execute a Docker. Obviously, an instance is enough to run as many Dockers as you want. Since the filing GitHub of boot2docker, it is indicated that it weighs about 24 MB and starts in about 5 seconds.
In this way, all developers, whatever their platform, are able to work on the same application, with a similar environment.
Ok, if I summarize: Docker only installs on Linux, so to run it on Mac or Windows, you need a VM that hosts it. Is not it a little bit the snake that has died its tail?
Yes, however, boot2docker and other available VMs are not intended to work in production, but only for developers wishing to place themselves under the exact conditions as the production servers.
As part of a production, the use of a Linux environment (and therefore not a Docker) is HIGHLY advised.
Attention, Docker requires a version 3.8 of the Kernel (compatible therefore for a Debian 8 or Ubuntu) at least. For the servers that are currently on Debian 7 (so with a kernel in version 3.2), the team in charge of development Docker has implemented a fallback to install a newer kernel without having to upgrade to Debian 8 called Jessie).
Docker, soon available natively on Windows.
Now, Docker is only available for Linux but a recent partnership between Docker Inc. and Microsoft provides for Windows container development. These will not be compatible with Linux but will meet the same need.
Docker, use case
Let us take a case of simple and concrete use.
A Lyon company that I will call at random Wanadev, wishes to develop a Symfony project as they know how to do. Their team is made up of two people.
Until today, we all said, "let's do unit tests". Yes, this answered a good part of our problems (on the condition of doing good unit tests).
In fact, it is a problem that two developers do not work on the same environments ... So, thanks to Docker, we can make sure that Manu and Baptiste work on the same Linux versions without fear of problems compatibility between their codes respective?
Exactly! In this case, the simplest is to set up a Dockerfile, "conductor" document, which will allow Manu and Baptiste to mount a similar image. By being smart, this Dockerfile will be modeled on the elements present in production. Therefore, Manu and Baptiste, in addition to working on an identical environment, will be in an environment similar to that of production!
Docker, deploy your applications easily
In my previous example, I highlighted the use of Docker to declare a single development environment. I think all Docker users should start with this before seeing bigger.
Above, I was talking about a particular version of PHP. It is obvious that you will not forget to install PHP on your production server, but maybe the configuration of your PHP-FPM will be slightly different. Perhaps you need an additional library like Imagick and its PHP extension. Maybe you need a Postfix to send emails. As many details as you might forget when you mount your production server.
To limit these errors, would it not be simpler to deploy the container (s) to run your application? In this way, rather than pulling source code and performing some deployment scripts, you could deploy a packaged consistent packet matching an application.
We often talk about an application in the world of the web, a " Symfony " application, would not be much without a front end like Nginx or Apache2, an engine like FPM or HHVM, and a database.
If I can run multiple Dockers on my machine, does that mean I can multiply the configurations as I wish?
That's quite right! In this way, you can build self-contained and isolated environments. The good old project SPIP in 5.3 could rub shoulders on the same server the last project Symfony with PHP 5.5. Cool not?
With Docker, multiply the environments on your machine without limiting the performance of your computer. Resources are shared with the host machine! Each environment can be configured simply by its Dockerfile, present at its root.
This article was intended to introduce you to Docker in general terms and to enable you to better understand the solutions that can be brought to the various problems of the developers. The rest of this article will be published in a few days. It will give you a first example of creating a Docker environment thanks to its Dockerfile.
Most Read Articles
Translate Our Site
Notice : Please be careful, after translation commands will change.
This website uses marketing and tracking technologies. Opting out of this will opt you out of all cookies, except for those needed to run the website. Note that some products may not work as well without tracking cookies.Opt Out of Cookies