A Simple Understanding of Docker :Analogy with Cargo Ship
This article gives a real life analogy of docker with cargo ship and very basic understanding of docker and some terminologies related to it.
Docker is a Dev-ops tool that automates the development, deployment and running of applications inside isolated containers.
Docker comes in Community Edition (CE) which is free to use and also in Enterprise Edition (EE) which is paid that comes with additional features.
Before moving ahead with docker, just a simple question.
What do we need to deploy/run an application?
- A server or physical machine on which we can run our application.
- An environment setup on that server/machine. For example if you want to run a PHP application, you might be using LAMP (Linux, Apache, MySQL, PHP).
- Finally you need the source code of your application to run on the environment which you can also store on git-hub.
For different tech stack application, you might need different environment such as, for java application — JRE, for java-script application — node environment may be required, etc.
And it might be possible that you want different version of environment based on compatibility of your application.
For simpler explanation I’ll be taking an example of a cargo ship.
Docker Analogy with Cargo Ship
Just consider your server as a cargo ship and you’re the owner of that ship, and the Host OS as the captain of ship.
Now as you know that there are separate multiple containers required to transport the goods. And the goods are transported in isolation i.e the goods of one container does not affect the goods in another.
Containers can be of same size and material or can be of different size and material based on the requirement to transport different type of goods.
Now consider there is a manger named DOCKER on the ship who is managing the boarding, de-boarding and maintenance of containers on the ship. So the manager here is Docker engine installed on your server.
Now for container you need an image, which can be considered as a blueprint to make the container of what size and material it should be. It is also possible that the blueprint can also contain the goods. Similarly for running different application you need different environments, the image can also contain the source code. Here goods can be considered as your application source code.
Now as the owner you can ask the manger to on-board, de-board the containers on the ship. Similarly you can ask the docker to run/deploy/stop your application on server.
So here for the on-boarding of a container you need a blueprint from which a container can be made. Similarly you need to give the image from which container can be made. You can store the image on docker hub and docker engine installed on your server will do the rest for you.
Docker will create a container from the image that you provide and do the rest of the configuration for the application that you instructed for.
Also as you can see in figure above, the containers are of different sizes implying that environment for each container is different and isolated from each other.
For your better understanding the analogies are as follows :
* Ship as Server
* Ship Captain as Host OS
* Ship Container Manager as Docker Engine
* Container Blueprints as Images
* Goods as Source Code of Application
* Ship Owner as Server Admin (Yourself)
SOME TERMINOLOGIES
Images — The blueprints of our application which form the basis of containers.
Containers — Created from Docker images and run the actual application.
Docker Daemon — The background service running on the host that manages building, running and distributing Docker containers.
Docker Client — The command line tool that allows the user to interact with the daemon.
Docker Hub — The registry as a directory of all available Docker images.
CONCLUSION
So here Docker is a smart manager that makes your life easier as the owner by communicating with the captain of the ship to manage the containers. Same way for deploying an application you need to run a container from the image and rest docker will take care of.
Now if you are not using docker then for deploying an application each and every time you will be setting up the environment and doing the configuration by yourself. Also, your applications are not isolated from each other.
And if you have two application that you want to run on different version of environment it’s not possible if you’re not using containers. For example one application you want to run on PHP 5.6 version and other application you want to run on PHP 7.0, then either you can use the concept of containers or you’ll require different servers altogether. So to transport different type of goods you’ll require two different ship altogether if you are not using containers.
This is my first document on Medium, I’ll be planning to write more soon. If you like the document and want to read more click here and follow me on Medium.
Thanks for reading! 👏