"But it works on my computer 🙄"
The process of software development is sometimes very complex and exhausting. A feature of a software might work correctly on one developer's computer, but it might not work at all on another developer's computer. Now, when they go to find the root of the problem, they see that, for example, they were using different versions of Node.js, and this very contradiction caused the result on two different computers to be different. Or maybe sometimes, to run a software, we spend hours of time to install all its libraries and dependencies and perform its other necessary settings.
And besides all this, if we work on several projects at the same time, each of which requires a different version of a programming language or other tools, managing all of these in the operating system for example, if it is Windows is very difficult.
Well, what should we do to make the process of development, deployment, execution, and publication of software easier?
Very easy: Dockerize your application.
Docker?
Docker is an open-source platform that is used to ease the process of development, deployment, execution, and publication of software. When we dockerize an application, it doesn't matter which version of a language or another tool is installed on our system, or if it is not even installed at all; it works identically on all computers, whether our computer or the server.
How to do this?
First, we install Docker Desktop on our computer, then we write a Dockerfile.
Dockerfile? A Dockerfile is a text file that includes all the commands that we write to build an Image. In simple terms, all the commands that we do manually for example, we install Node.js, we run npm install, and other commands to run an application on our computer we put in the Dockerfile. Remember that the name of this file must strictly be Dockerfile.
And speaking of Image, what is an Image?
An Image is an instance of our application that includes all the libraries, dependencies, code, and other items related to the app.
From Dockerfile to Container
Well, now we have written the Dockerfile. When we run the command docker build -t in our terminal, it builds an Image for us, and if we run the command docker run , it builds a Container for us.
Container? A Container is the running version of our app. Do you remember reading above that if we have several projects on our computer and each needs a different version of Node.js, Docker can solve this problem? Docker solves this problem with the container.
How? Because each container runs completely in a separate environment without interfering with the operating system. It doesn't matter how many apps are running; they don't know about each other at all. That is, Docker performs Isolation, in a way that all the files of the containers, the networks between them, and the resources they use are separate from the operating system.
Well, up to here, we got acquainted with concepts such as Docker itself, Container, Image, and Dockerfile. Of course, Docker is a very long discussion; this is just a short introduction. How to write a Dockerfile? How to do Port Mapping so we can see our app in the browser too? How to do Bind Mount? These are all very important topics that, Inshallah, can be explained in future posts.
Have you worked with Docker until now? Write about your experiences. 👇










