What is Docker, Why should you use it in simple words

Shahin Ghasemi
3 min readJun 15, 2020

--

Photo by S'well on Unsplash

I’m going to write a semi-brief description of Dockers, their use cases, and the problems they’ve solved so far. I believe learning should be done interactively, therefore I’ll use the Q&A method to make it easier for making more sense.

Ready? so, let’s dive in!

1. What does docker do and why should you use it?

First of all, there is no necessity to use docker for your project and that’s only a valuable option in front of you.

You can deploy your application directly on your servers, however, you should not! using docker will give you a lot of benefits which we are going to discuss about.

The first and most important one, docker will isolate your codebase from the outside. This isolation is in OS level which makes it so light and optimized.

It will make your code damn portable. you package your whole project into one image and there you go! You can use that image to create a container and run your project everywhere you want without worrying about weird errors that might happen during package installations.

2. What? Images? Container?

Images are instructions for creating containers.

If you have experience of coding with Object-Oriented-Programming, you can think of Images as classes and containers as instances of that classes/images.

In other words, images are not useful merely on their own, since they are kind of an instruction for creating instances(containers), however, you can’t create containers without images. So, containers are dependent on images.

3. I can’t get it; what does the image really do? Please give me a simpler explanation!

Okay, it’s sort of a map which says: “Hey Container, I want you to be like this, install those packages and these libraries, use this operating system and please provide me these resources and so forth..”

4. Okay, I think I got it, but I really didn’t understand when to use dockers?

Again, there is no necessity over using dockers for your project and it’s totally an available option, however, If you want to make your project as reusable, portable and optimized in terms of resource usages as possible then docker is your friend. Nevertheless, if your project is big enough to be consisting of many different parts then docker is a must for you.

Photo by John Barkiple on Unsplash

5. I got it; I have to use docker for big projects only?

Not quite correct, even though you can use docker for any types of projects from simplest to the largest, using docker for a project as simple as creating an HTTP server might be an overhead, however, as said, there is no strict rule for using docker for only big projects. Of course, you can dockerize any project as you wish.

6. Wait! What? Dockerize?

The process of creating containers out of images is called dockerizing. To do so you create a ‘Dockerfile’ in your project root directory then use ‘docker built -t somename:sometag .’ command.

It is as simple as it is. Accordingly, your project is dockerized and you can use the image everywhere you want to run your project with a happy face 😉

I hope you have gained the knowledge about dockers and you can simply explain it to others as well.

You can follow me on Instagram if you want @shahinghasemiy

Thanks for reading.

--

--

Shahin Ghasemi
Shahin Ghasemi

Written by Shahin Ghasemi

Node.js and react.js developer striving to learn new things everyday

No responses yet