What is Docker?

What is Docker?

 Hmm so most of you might know about docker and maybe you don't even know about it.

Let's start thinking about it by asking ourselves why we need docker. For all of you developers out there they might come to a situation where they have to send their work to their Boss and run it, but sometimes the program or software might run in your pc or laptop but might not run in their devices. Or maybe simple let's take an example you're making a Node application with some database and you have done all the stuff and it's working well but when you send it to others sometimes it might not work. Maybe due to different dependencies or maybe the node application cannot interact with the database server this issue may be critical sometimes because we have to check which versions to use and which software to use which might be a tedious job.

Now docker comes into the picture. Docker is a container. So first let's talk about containers. You can think of containers as just the containers near some ship dock and the ship dock is a docker. As all the content of the containers is isolated from other containers same goes for docker containers. The isolation in computer software is very important nowadays for many reasons first it provides security if one part of the container is affected it doesn't reach the other containers. If there is some problem with the software we can figure it out quickly.

But What actually does Docker store?

We might sometimes hear about virtualization or virtual box or VMware this is the software and technologies which let us run diff operating systems in the space pc. docker takes it to next level. In a virtual box architecture at the base, it has a main operating system then the hypervisor, and the diff virtual boxes on which we can install the different operating systems but in docker, it's a lot more clear it removes the hypervisor part and directly interacts with the host operating system. Bonus point for the less size of docker which is far less compared to the virtual box.

Container vs VM (Virtual Machine) - Know the Difference

Getting started with Docker...

For building and working with docker we need some commands and experience with docker

So let's get started Fire up the terminal and let's do some docker commands.

  • For installing docker use the command

 sudo apt-get install docker

So, docker, has a site owner has Docker Hub where it has all the required images for docker which we can pull and start building it. For this, we shall pull a ubuntu image

docker pull ubuntu

We will make a container now With the name Our_First_docker_container

docker run -d -t --name Our_First_docker_container ubunto

How To Build Docker Images for Windows Desktop Applications - DZone Cloud

That's it you just build your first docker container that too within seconds by virtualization it may take a lot more time.

To see all the running processes we can use.

To get into the container we can use the following command

docker ps Docker exec -it {your container name} bash

That's it you have got the root shell of your container to see how it is easy to build and run docker containers. And you can run as many containers as you want and that too in a crazy manner like running and windows server inside a Windows machine running Windows inside a Mac and also ubuntu inside ubuntu, yeah I know that sounds crazy. And also they are completely isolated from each other like I mean they don't even know they are some image files they for themselves think that they are their own operating system coz all the docker containers have their own system files their own system process which all other normal operating system has. That's where we can imagine the power of Docker

How to get started with Docker?

Point to be known the Docker is an open-source technology. So all the code of it can be seen on GitHub.

So let's get started installing a docker. For this, we use a Linux machine.

  • First, create a new folder and keep all the files related to your app in that.
  • Create a Dockerfile. Dockerfile is a simple file that tells docker what to do and what dependencies we need for the app to run.
  • Then we can run the Docker-compose up command to run the app.

That's it you actually started your own docker app.

So what next.

Image yourself has a developer and you have built some app so how will you send it to your boss and our co-developers. I guess maybe from GitHub or sending it through a drive but with docker, it becomes a lot easier. You can just make individual Docker files for each user like for app a node js container for database and SQL container and etc. And send the docker image to your friends. And they can pull the image and run the following commands to get the app run just in seconds that's what makes docker so important. Not to mention all the containers are isolated

So that's all for this blog.

 Stay tuned to get more updates


Previous Post Next Post