NH

Geting started with Docker

Cover Image for Geting started with Docker
Nasrul Hasan
Nasrul Hasan

Installation of Docker

Mac and Windows Installation

For mac and windows the easiest way to getting started with docker is to install Docker desktop from their official site. You can find the installation link below.

Link to Download ---> Docker Desktop

Just download the application and install on you machine.

Linux Installation

For debian based distro like ubuntu simply use snap package to install and remove docker

 sudo snap install docker

Now check if it is installed correctly by running

 docker --version

Additionally we can add our user to docker group, so that we don't have to prefix our docker command with sudo everytime.

To add user to the docker group simply run this command (For linux only)

 useradd -aG docker <you-user-name>

Getting started with Docker

Now docker is installed in our system, we will verify by running the first container.

 docker run hello-world

Docker run

What is Docker Container

Docker container is an isolated environment in your host machine which can run application and services. Docker containers are like virtual machines but they did'nt have their own operating system instead they share OS of their Host machine. Containers have their own file system and process tree.

Why is Docker required

All the application require their own dependency/packages to run on any system. Suppose if two application is using the same package but different versions? Also if load on your application increases how do you scale your application?

To solve these kind of problems first Virtual machines (VM) are created. they helped us creating multiple environment on one host. It solved the problems but managing VM was a difficult task because each of them required a separate OS, and resource consumption is also very high.

Then containers came to rescue like Docker, which are lightweight because they shared the host os also they are portable which means we can run them on on multiple server with ease.

What can you run on Docker?

Anything which is a running process can be run on docker. Whether it's your web application written on python, java, .Net etc or Databases like mysql, postgres. Also you can dockerize games :P

How do you do it

Well docker has a concept of images. We can create image from our code/application and then run it as a docker container.

Image is a blueprint of a container. We can create as many instance of container from same image. This concept also helps in scaling of application.

To run a container from image we can use command

 docker run <image-name>

Here image name is the blueprint of container. For eg: the first command we run was, "docker run hello-world" so hello-world was the image name which was a prebuilt image.

we can find all prebuilt images on dockerhub repository Dockerhub Images.

To learn more about docker please checkout my blog Docker for developers (coming soon....)

Thanks for reading...

#docker#devops#deployment#containers