Docker
November 15, 2021
Build Applications like a pro.
What is Docker ?
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly ( definition from docker website).
This probably sounds like gibberish to you right ? Don't Panic, It also made no sense to me once i first started learning about docker. But i'm going to explain it to you in "english".
Docker is a unix machine that is used to make containers and images for a certain application and break it down to microservices.
i think at this point it's safe to say that docker is used (but not limited) to creating microservices.
we will go through the other uses of docker in a bit. first lets see what developers used to build microservices before docker.
But microservices existed before docker ?
yeah, that's true.
microservices existed way before docker but they were installed using virtualization, multiple virtual machines were installed in a single hosting machine.
This had one major drawback.
It caused wastage of resources, since they could not maximize the usage of memory, processing power, disk space e.t.c .
This is where docker thrives at docker does not need pre-allocation of resources hence solving the memory leaks problems.
why Docker ?
If your still not convinced to start using docker here are a few reasons to atleast try it out.
Helps you run consistent containers.
You can use containers to run the app, independent of the resources you have on your local machine.
You can also use docker to run your app on any platform, You run a container containing a virtual machine that has it's own operating system.
intergrates well with continous intergration.
Dockerizing applications .
Dockerizing your applications is not a very hard task. However,it can be challenging depending on the complexity of your applications.
Nevertheless, it usually follows the same pattern which i will take you through.
step 1 : create a docker file
a docker file is a text document that contains all the commands a user could call on the command line to assemble an image.
step 2 : build an image.
an image is a file used to execute code in a docker container. Docker images essentially act as a set of instructions to run an application.
step 3 : run a container.
a container is an instance of an image, it is a lightweight, standalone, executable package of software that includes everything needed to run an application.
conclusion.
Hopefully, by now you have an idea of what docker is. In my next article i will take you through the steps of dockerizing a fullstack application.
Happy Coding Nerds!