Federico Zacayan

Software Devloper.

Docker

If you work as developer, you need also resolve the problem of install your environments yourself.

Docker help you to deploy your environment and documented in a single plain text with no more than 10 code lines

It is really simple, but there are some concepts you have to handle properly.

If you need to run an application too, you will need an Operative system, and the application on it.

Application
Operative System

The green square is the image1.

The red square is the image2.

As you can see, the image 2 contain the image 1.

This is one of the main concept of docker.

If you need to use the Application to provide a Service. Probably, that you need is the following image3.

Service-Y
Application-A
Operative System I

This is great! But, what about if in your own computer you have an Application-B?

Application-B
Operative System I

We can use the same Operative System I!

Awesome, until now we know what if we need a Service, probably we need the Application-A, and the Operative System I.

If this is the case, if we need also the Application-B, we only need the Application-B because we already have the Operative System I.

The Operative System I, is into the image of the Service, and into the Application-A.

Suppose we do not need Application-A, but Custom-Application-A.

In this case we still need Application-A to make some customization on it.

So the image we need is the following.

Service-X
Custom-Application-A
Application-A
Operative System I

Of course, the Service-Y and the Service-X are similar, but not the same.

So, if we need to use the Service-Y or the Service-X we just need to build an image.

Build Image
Service-Y
Build Image
Service-X

Once we get the images, we can run the containers.

Run container
Service-Y
Run container
Service-X

And then we can stop the containers.

Run container
Service-Y
Run container
Service-X

So, what happen if you want to delete an image?

If his container running it is not possible delete it, unless you force to delete the image and all their containers.

Suppose the size of Service-Y is 75MB. (25MG OP, 25MG APP, 25MG SRV-Y).

Question 1. What is the size of Service-X?

Other interesting question is Question 2. How much space we need for Service-X?

Answer of question 1 is 1GB. (25MG OS, 25MG APP, 25MG APP-CST, 25MG SRV-X)

Answer of question 2 is 50GB. (25MG APP-CST, 25MG SRV-X), Because your local environment already has OS and APP.

As you can see, Docker use layers to build the images.

Now, to finish, what about if I tell you that you can run both systems executing only one command line using just one plain text of 10 lines of configuration?

This is not only possible, but also desirable!!!

Now is time to code. I would like to write some examples, but I have not enough time and there are bunch of tutorials and blogs for it.

So, see you next.