· Tutorials  Â· 5 min read

Docker for beginners - Part 1 - Introduction and Installation

Docker is a tool that allows you to run applications in containers. Containers are like virtual machines, but they are more portable and resource-friendly. In this tutorial, you will learn what is Docker and how to install Docker in your local machine.

Docker is a tool that allows you to run applications in containers. Containers are like virtual machines, but they are more portable and resource-friendly. In this tutorial, you will learn what is Docker and how to install Docker in your local machine.

Series Overview

What is Docker?

Docker is a tool that allows you to run applications in containers. Containers are like virtual machines, but they are more portable, lightweight and resource-friendly, while being loosely-isolated from the host machine. Dockers are famously used for running microservice-based applications.

To understand the purpose of Docker, let’s take a look at some scenarios.

Scenario 1

As a developer, you are working on a web application that uses Node.js and MongoDB. You have installed Node.js and MongoDB in your local machine. You have also installed the required Node.js packages and MongoDB drivers. You have written the code for your application and it is working fine in your local machine. Now, you want to deploy your application to a server. Somehow you managed to install Node.js and MongoDB in the server and finally deployed your application. But, your application is not working in the server. The application which works fine in your local machine is not working in the server. Why? This can explained by the differences in the environments. Your local machine and the server may have different operating systems, different versions of Node.js and MongoDB, different versions of Node.js packages and MongoDB drivers. This is a common problem that developers face. This is one place where Docker comes in handy, by having the same environment in both local machine and server. We’ll see how Docker does this later on.

Scenario 2

Again as a developer, you have developed an application and deployed it to a server. The application is working fine in the server. Now, you want to deploy another application to the same server. This application also uses Node.js and MongoDB. But, this application requires a different version of Node.js and MongoDB. You cannot install both versions of Node.js and MongoDB in the server. This is another place where Docker comes in handy, by having different environments for different applications. Again, we’ll see how Docker does this later on.

Scenario 3

After developing your application, you want to deploy it to a server. But you would also want your application to be scalable. You want to run multiple instances of your application in the server. At the same time, you want to make sure that each instance of your application is isolated from the other instances. Initially, you may be attracted with the option of Virtualization. You can create multiple virtual machines in the server and run your application in each virtual machine. But, this approach is not easily scalable. You will have to create a new virtual machine for each instance of your application. This is again yet another place where Docker comes in handy, by having multiple instances of your application running in the same server, scaled up or down as required. Again, we’ll see how Docker does this later on.

These are not the only problems that Docker solves. There are many more issues than these.

Now, how does Docker solve these problems?

Well, everything in Docker is built around the concept of containers. A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. First, you will package your application and its dependencies into a container. You can then run the container in any environment. The container will run the same way in any environment. You can create multiple instances of the container and run them in the same environment. Each instance of the container will be isolated from the other instances. You can even chain multiple containers together to create a microservice-based application. This is how Docker solves the problems mentioned in the scenarios above.

In this tutorial, you will learn how to install Docker in your local machine.

Installing Docker

Docker is available for Windows, Mac, and Linux. To download Docker, go to https://docs.docker.com/get-docker and select version that matches your operating system.

Docker Download Page

In this tutorial, we will stick to Windows. So, I will download the Windows version of Docker Desktop.

Docker Installer

Run the installer as administrator. You will be prompted to allow the installer to make changes to your device. Click Yes.

Docker Installer

Proceed with default configuration and click Ok to start the installation.

Docker Installer

Once the installation is complete, close the installer.

Docker Installer

Open the Start menu and search for Docker. You will see Docker Desktop in the search results. Click on it to launch Docker Desktop.

Docker Desktop

Since you are running Docker Desktop for the first time, you will be prompted to accept the license agreement. Click on Ok to accept the license agreement.

Docker Desktop

Docker Desktop will now ask your role and purpose of using Docker. Select the option that best describes your role and purpose of using Docker and click on Next.

Docker Desktop

Now the Docker Desktop is completely setup and ready to use.

Docker Desktop

Wrapping up

In this tutorial, you learned how to install Docker in your local machine. In the next tutorial, you will learn about Docker images and containers.

Next: Docker for beginners - Part 2

Back to Blog

Related Posts

View All Posts »
Docker for beginners - Part 5 - Docker Compose

Docker for beginners - Part 5 - Docker Compose

Docker Compose is a tool for running multi-container applications. It defines the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.

Docker for beginners - Part 3 - Docker CLI

Docker for beginners - Part 3 - Docker CLI

Docker CLI is the command-line interface for Docker. It allows you to interact with Docker daemon using commands. You can use Docker CLI to build, run, and manage Docker containers. In this tutorial, we will learn about some of the most commonly used Docker CLI commands.