Docker for Beginners: What is Docker and How to Create Docker Containers

Docker for Beginners: What is Docker and How to Create Docker Containers

 If you have been in touch with the latest developments in the programming world in the past few years, you would have noticed the loud buzz surrounding Docker and Docker containers. This popularity of docker is not without reason. The introduction of Docker has vastly changed how developers approach application development.

Docker for Beginners: What is Docker and How to Create Docker Containers



Who wants to be left behind when such a revolutionizing technology hits the programming world? So, today, we are starting a new tutorial series for you to learn how to use Docker for application development. If you are an absolute beginner to Docker, this tutorial series is the right place for you to start.

In the first article of our tutorial series, we are looking to understand what exactly Docker is and why developers love Docker so much. We will also be dockerizing a simple Node.js application to familiarize you with the basic concepts of Docker.

Why wait any longer? Let’s begin!

What is Docker
Docker is a tool that is used to build applications; that is to create, deploy, and run applications through containers.

With a container, all the libraries, and other dependencies required to run an application, are packed as a single package for deployment.

The main goal of containerizing an application is isolating them from other applications running in the same system. This approach ensures applications don’t interfere with the operation of one another and makes application maintenance much easier.

Though containers running in the same system are isolated from one another in execution, they share the same OS kernel. Hence, containers are more lightweight compared to the alternative choice for isolating application execution, virtual machines.

A containerized application running on your Windows OS is guaranteed to run without an issue in another user’s Windows machine despite the change of environment.

Though containers have been long in use before Docker, the introduction of Docker popularized using containers in the developer community. There are two components that are used when dockerizing an application: Dockerfile and Docker Image. Let’s find out what they are.

Dockerfile
Dockerfile is a text file that contains a set of commands required to build a docker image. Dockerfile contains information about the underlying OS, the language, file location, and network ports among other things.

Docker Image
When you run Docker’s build command with a dockerfile in place, a docker image is created based on the dockerfile. They act as templates to create the final docker container. Once created, docker images are static. You can invoke Docker’s run command to create the docker container using a docker image.

Dockerizing a Node.js Application
In this tutorial, we are going to dockerize a Node.js application. We will follow a step by step approach to get the Docker container up and running.

1 - Create the Node.js application 2 - Create the dockerfile 3 - Build the docker image 4 - Create the application container

Before diving into dockerizing our app, you should make sure Docker and Node.js are installed in your system

Install Docker on your system—I will not cover how to install Docker in this tutorial, but you can follow Docker documentation and install Docker on your Windows or Ubuntu desktop.
Download and Install Node.js from the official website



Published on:https://devqa.io/docker-tutorial-docker-for-beginners/

You may like these posts