Skip to content

Blog

How Docker works: the Ideal tool for coders

Aymane Abssi

How many times has every programmer had to deal with a project that uses a very specific database, web server or version of the programming language? In this case there are two alternatives: install every single application on your own computer and hope that everything works, or use Docker, which isolates each service in containers. As far as containerisation is concerned, the Docker software offers the possibility of creating, distributing, moving and copying containers from one environment to another.

Today Docker is practically an obligatory choice given the sheer range of environments you can have for each project, and it is an integral part of the dotenv workflow; since we work on projects that are very different from one another and built around the client’s needs, having a system that perfectly replicates the client’s IT environment is fundamental. Find out more in this article.

What Docker containers do

A container is basically an instance of a service isolated from the rest of the computer and from the other containers. Their function lies mainly in the ability to isolate applications and services from the underlying operating system and from the other containers on the same machine. This isolation makes it possible to run several instances of software securely and efficiently, without them interfering with one another.

As a result, you can have many instances running at the same time, which means you can have, for example, two database engines or two versions of PHP at once.

Another fundamental feature is security: since each instance is isolated from the others and also from the operating system, it becomes very difficult for a running process to access the computer’s resources (for example the whole hard disk with administrator privileges).

Advantages and disadvantages

Are there disadvantages? Yes, mainly performance. Having PHP running natively on the computer, for example, gives far better performance than you get with PHP isolated in a container and therefore “virtualised”. The most noticeable drop in performance occurs on MacOS, especially if there is frequent file access.

But the advantages are far greater. When distributing the code and the project to other programmers, in particular, having Docker installed on the computer is enough to “bring up” a structured and essentially identical environment, with no need for particular configurations on each programmer’s individual computer.

Summary of Docker’s advantages

  • Modularity, for example, because with Docker you can split the application into small parts that are simpler to test and share. We were talking about the isolation of individual containers and processes but, where needed, the various containers can be made to talk to one another, leading to more complex solutions such as a LAMP or LEMP server made up of several containers.
  • Docker images are also made up of “several small pieces”, so if there is an update or a change to the image, there is no need to download everything again, only the relevant change. And if there are problems, it is easy to go back to the previous version of the container image.
  • When deploying the application, you can also use Docker on the production server: this way, in the event of changes or updates the downtime is limited to the few seconds it takes to update the container, making everything much more stable and resilient.

Docker is an indispensable solution for programmers who want to manage development and production environments efficiently and securely. The ability to create isolated containers avoids conflicts between services and simplifies the process of distributing code.

By adopting Docker, at dotenv we are able to perfectly replicate our clients’ IT environment, guaranteeing an optimised workflow and greater client satisfaction.

Discover our experience and the projects we have delivered, and how we can help you optimise your development processes. Visit our website or contact us today for a personalised consultation.

Contact us now!

If these topics interest you, we also talk about them out loud.

Nessun Segnale is dotenv’s podcast: 41 episodes, with guests who build software and products.