It’s been almost a year for me as a Software Engineer after completing my Bachelors and I have decided to put together all my learnings: both as a newbie and an average technically sound fresher; I am starting with offering a short series on DevOps for anyone who might get to work for a little on this or need related information time to time.
Of course, Let’s start with …… DOCKER!
In simple words, let’s see what will happen if you have two projects you wanna deploy to server:
One Node JS based and one Java based. Both of these projects require certain libraries and dependencies. These libraries/dependencies are dependent on the OS we use. And, things become messy and hard to manage if there are frequent upgrades required; both to our application and to the frameworks we use.
To overcome this, VMs were introduced that offer full isolation in terms of dependencies. Each project can have its own set of independent resources and hence VMs are heavy to be able to incubate independent running apps. Yeah, that’s why it takes minutes to start!
VMs are super useful if we want full isolation with guaranteed resources but what if we are looking for something that separates processes and runs them on a fairly adequate host?
Docker gives you the ability to snapshot the OS into a shared image, and makes it easy to deploy on other Docker hosts (Any server that supports hosting docker images!).
When an image is deployed, it’s running instance is called a container. Container accelerates the deployment process by shipping everything (Libraries, dependencies etc) as one package. This enables the quick and smooth run of the application across environments.
The key this to note is, Container are not VMs. They don’t offer virtualisation. The host and container OSs must be the same. In docker particularly, the base OS is Linux. Further, The resources containers use are also of the host machine.
So, Docker -> Isolation
VM -> Vitualisation
Apart from the Commands elaborated in docs, here are the most common commands I have personally used
- docker ps: To know all the running containers and their information
- docker exec -> ssh/sudo exec -it <container_id> -> get inside of a running container
- docker pull -> pulls an image from a repository/registry
Next we will learn about Container Management and orchestration and how Kubernetes (K8) is useful for same.