What is Docker and How it works | DevOps
Tags: devops, webdev, javascript, beginners
Published: 2022-12-04 14:08:12

### 📍 Deployment and Testing

Many of us write code of our RESTful API or in general our App. And we deploy them to the Heroku or Vercel (😅 These hosting servers are quite a popular among college people atleast). And after that we can access our website that will be served by the hosting vendors like heroku or vercel.

🙋 But most of the developers (especially beginners) do write code and the things, that they don't consider are:-

- **Code should be able to run on any machine**
- Unit Testing
- [Performance Testing](https://dev.to/lovepreetsingh/make-thousands-of-requests-to-your-server-jmeter-2nhg)
- Concurrency or Concurrent Servers
- Documenting the code

👉 Today, we'll talk about the first point and this is where concept of containerization comes into the picture.

_Note:- Images are taken from [SimpliLearn](https://www.youtube.com/watch?v=rOTqprHv1YE)_

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fsxzdm4p59xtlxclgg45.png)

The solutions to the above problem (Code is running fine on my system but not working on the machine of tester) are:-

- Use Virtual Machine
- Use Containers

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p86jmlgo5rl4t4qi6gh4.png)

🙂 One of the solution is use a Virtual machine which is a kind of simulation of a Computer. But OS in VM (Virtual machine) takes too much memory, large boot up time, Difficult to scale and low efficiency in general because of unnecessary things running that are not required to run our app.

### 📍 DevOps and its tools

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igf8z7c0jixhmak0cq4v.png)

- Git and Jira are used for the roadmap of doing things
- Gradle is used for laying out the Project structure
- Testing is done using selenium
- Integration (CI/CD) is done using Jenkins
- Docker and is used in Deployment

**_Follow for more, We'll talk about others in later blogs_**

### 📍 What is Docker

Docker is a tool to containerize the application so that applications can work in different environments.

🙂 Some Containers Specs:-
- Multiple containers can run on the same hardware
- Containers maintains isolated applications
- Productive and Efficient
- Easy to configure

![Programming memes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/npbv5jijzxf8kh078u2y.png)

_Hey, We are almost at the end. Don't give up._

![Docker Different Components](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qdp3t0w24usmdb9hz637.png)

📍 On the left we can see that Docker engine has client and server which are communicating through REST API. On the client side Docker CLI is running and Server side we have Docker Deamon.

📍 In more detail we can see on the right side we have different components comprised inside of Docker ecosystem.

👉 **Let's see how it works:-**

- Docker Client is accessed from the terminal and docker server or host runs the Deamon and Registry
- User can create docker images and run containers by passing commands to the docker server using docker client or terminal
- Docker image is a template having instructions to form up the containers. Docker image is created as Docker file
- After image creation we store it in the registry so that other people can access it from the registry

![Docker Container](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3qkg37r3u7vaq634kxy.png)

-----

**In our next Blog we'll see the Working of Docker. It will get more clear from that. [Follow for more](https://dev.to/lovepreetsingh)**