22 July 2021
Are you a techie? Of course you are if you’re here, reading this blog. So you must’ve at least heard of Docker: a helpful tool for packing, shipping, and running applications within “containers.”
Regardless of whether you have a use-case ready in mind for Docker or not, it’s still important to understand some of the fundamental concepts of what a “container” is and how it is compared to a Virtual Machine (VM). While the Internet is full of excellent usage guides for Docker, I couldn’t find many beginner-friendly conceptual guides, so let’s begin..
Don’t know what a Docker is?
Docker is a computer program that performs OS-level virtualization, also called “containerization”.
It is a tool that reduces the complexity of the communication that is required between teams while deploying software in the production. As a developer, we can build various containers which can have different applications installed onto them. We can give it to the Testing team and they will only need to run a container to replicate the development environment. How does it help? It helps in such a way that there is no need to install all dependency softwares and applications by the Testing team to test code and so, it will save a lot of time and effort.
Docker is not a virtual machine (VM)
A Docker container does not require or include a separate OS, unlike a virtual machine. Instead, it depends on the functionality of the kernel and uses resource isolation for CPU and memory, and separate namespaces to separate the application’s view of the operating system.
Google has been using its own container technology for years now. Other Linux container techs which include BSD jails, LXC, etc. which have been around us for many years.
So why is Docker all of a sudden gaining popularity?
- Speed: Docker containers are very lightweight and fast. As containers are nothing but just sandboxed environments running on kernel, they take up fewer resources. You can run a Docker container in a few seconds, compared to Virtual Machines which might take much longer as they need to boot up a full virtual operating system every time.
- Easy to use: Docker has made it much easier for us — developers, sys admins, architects and others – to have the advantage of containers in order to quickly test and build portable applications. It allows us to pack an application into our personal laptops, which in turn can run unmodified on any public cloud (GCP, AWS, AZURE etc.), private cloud, or even bare metal. The motto is: “build once, run anywhere.”
- Docker Hub: Users of Dockers also take advantage of the rising rich ecosystem of Docker Hub, which can be thought of as an “app store for Docker images.” Docker Hub has tens of thousands of public/open images created by the community that are readily available for use. It is incredibly simple to search for images of your needs, ready to pull down & use with little-to-zero modifications.
- Scalability and Modularity: Docker makes it easy to split out the application’s functionality into individual small containers. For eg., you might have your Postgres database running in one container and your Redis server in another while your Node.js app is in another. With Docker, it has become easier to link these containers together to create our application, making it easy to scale up/down or update components independently in the future.
Last but not the least, who doesn’t love the Docker whale? 😉
A few underlying technologies & Terminologies..
Images consist of one or multiple file system layers and important metadata that represents all the files required to run a Dockerized application. Every Docker container is based on an image, which provides the basis for everything that you will deploy and run with Docker. To launch a container, you can either download the image from Docker hub or create your own new Docker image.
Docker container is an instance of the image. You can create multiple containers from the same image without any hassle. A container is a self-contained execution environment that shares the kernel of the host system, which is separated from all other containers in the system.
A Docker-compose file?
Docker compose is a tool for defining and executing multi-container Docker applications. You can compose a file with it to configure your application’s services. Then, using a simple command, you can create and start all those services from your configuration.
Since the installation depends on your own operating system, we will not cover it here. To install Docker on your OS please follow the below official references:
I hope you’ve now gained the knowledge you need to learn more about Docker and maybe even use it in a project one day 😉