Introduction To Docker!
Tags: docker
Published: 2020-01-09 04:15:53

Happy New Year 2020!

This article is for beginners only. Specially for those who have never used Docker or want to get the hang and feel of Docker. Hence this is a very basic tutorial. In my further posts I will be covering more practical projects.

**So what is Docker?**
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. [(Source: Wikipedia)](https://en.wikipedia.org/wiki/Docker_(software))

In order to use [Docker](https://www.docker.com), you need to [create an account](https://hub.docker.com/signup). While creating your account, you will be asked to create your Docker ID. Hence this docker ID will be used in future such as to login in [Docker Hub](https://hub.docker.com/), to identify your [Repository](https://hub.docker.com/repositories), upload to your repository etc.

Once your account has been created, you will need to download the Docker software called as *'Docker Desktop'* on your system.

So let's get started!

I've just begun using Docker and as I discover, I will upload more articles on the same. This article I've found on the Docker site and followed their step by step procedure and I was able to achieve the result. Following is the same URL for the [Quick Start Tutorial](https://hub.docker.com/?overlay=onboarding)

**Step 1: Download**
Let's get you started: you will need to download and install Docker to use the Docker command line interface (CLI).

Docker Desktop
The preferred choice for millions of developers that are building containerized applications

Download Docker Desktop for [Windows](https://download.docker.com/win/stable/Docker%20Desktop%20Installer.exe) or [Mac](https://download.docker.com/mac/stable/Docker.dmg)

**Step 2: Clone**
First, open a Mac terminal or Windows PowerShell and download a fun example.
This repository contains everything you need to create your first container.

`git clone https://github.com/docker/doodle.git`
(Requires [Git](https://help.github.com/en/articles/set-up-git))

**Step 3: Build**
Now let's build and tag a Docker image.
A Docker image is a private filesystem, just for your container. It provides all the files and code your container will need. Running the docker build command creates a Docker image using the Dockerfile. This built image is in your machine's local Docker image registry.

`cd doodle/cheers2019 && docker build -t <docker_id>/cheers2019 .`

Replace `<docker_id>` with your Docker ID which you have entered while creating Docker Account.

**Step 4: Run**
Great! Now let's run your first container.
Running a container launches your software with private resources, securely isolated from the rest of your machine.

`docker run -it --rm <docker_id>/cheers2019`

You should be able to see the output as below:
![Docker Output](https://thepracticaldev.s3.amazonaws.com/i/lz64wmpmzs11grjjgv3i.PNG)

**Step 5: Ship**
Share your image on Docker Hub
Once you're ready to share your container with the world, push the image that describes it to Docker Hub.

`docker login && docker push <docker_id>/cheers2019`

If everything up to here is done correctly, then

**Congratulations**

At this point, you have successfully set up Docker Desktop and Docker Hub. You have built, run and shipped your first container. Carry on to master all the power of the Docker platform.

Thanks for reading.
Cheers!