For me understanding Docker was very obvious, logic and easy. Couple months ago I started implementing Docker in the development team but then I discovered most of them don’t know what they are doing! That’s when I decided doing internal presentation for all the development teams and the managers.
So the first part was explaining what is container compared to what we already do or have…
As usual I love sharing my work with others in the hope that it might help someone else out there and so you can share it with others…Learning and knowledge should be available to anyone!
To explain what is a container for non technical people I had to start all over from physical machines, what is a virtual machine and what is a container and explain the difference with a real life examples.
Docker explained for non technical
Imagine a House, you have multiple bedrooms and bathrooms, living room, kitchen…
- You most-likely don’t occupy all the house
- Expensive to decorate and furniture
- The space is not optimized
- Takes time to maintain, clean and secure
That’s exactly how a computer works (physical server):
On a computer you have multiple application, packages and libraries that you don’t use most of them! For example on a MacBook computer you might not use the entire disk space and/or the memory available… That’s a waste of resources! You might have some applications like mail app or the calendar app that you don’t use, this is also a waste of resources!
- Slow deployment times
- Huge costs
- Wasted resources
- Difficult to scale
- Difficult to migrate
And what if you want to install different applications on your computer/server but with different requirements
First option is to make a choice and remove some applications, but I need them all to be running other option is to install each application on a different computer, it will take time to be done, maintain and manage plus it’s expensive!
An apartment ?
One of the options to cut the expense and optimize time, money, space is to get an apartment!
Virtual Machine (VM) is an emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination.
One physical server can contain multiple applications, each application runs in a virtual machine (VM).
- Better resource pooling
- One physical machine divided into multiple virtual machines
- Easier to scale VM’s in the cloud (AWS, rackspace….)
- Rapid elasticity
- Pay as you go model
- Each VM still requires
- CPU allocation
- An entire guest operating system
- The more VM’s you run, the more resources you need
- Guest OS means wasted resources
- Application portability not guaranteed
We still have some CONS with the apartments, waste of time and resources. The apartment is not fully occupied and not easy to move from one building/apartment to another. With Hotels problem is solved!
In the Hotel room you have only what you need, everything else is shared/common with the others hotel clients, You can move easily from one hotel to another, the space is fully optimized and easier to maintain/clean.
- Each guest instance is called a container
- Each container has its own
- Root filesystem
- Network ports
This is how containers system work: we have a server, it could be a physical server or a virtual server (VM). We install our OS and the containers that we create interact with the OS’s kernel. It uses certain features of the kernel to create an isolate application platform. Within each container we can install our application and the libraries that our application depends on.
Why don’t we install all our applications without using the containers?
Most applications need to use various 3rd party libraries, example : Three Java application and we need each of these using different version of Java. It will be very difficult to have all three application running on the same machine without any conflicts. With containers we run each application isolated with its java version.
Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating system–level virtualization on Linux. Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting virtual machines.
With a container system it is very easy to move from one node to another, the same way you can change an hotel.
- Containers are more lightweight
- No need to install guest OS
- Less CPU, RAM, storage space required
- More containers per machine than VMs
- Greater portability
- All containers shares the same kernel of the host
It depends on your architecture and your requirement, but one thing can be done is combining Virtual Machines with Docker.