DEV Community

Cover image for Containerization and Docker...! Getting Started
Kshitiz Saini
Kshitiz Saini

Posted on • Updated on

Containerization and Docker...! Getting Started

series: [Learning the Docker Containerization]

Docker is an OpenSource containerization platform for Building, Shipping and Running applications using Container Virtualization technology. Docker packages all the dependencies in form of a Docker containers to ensure that our applicaton works seamlessly in any of the environment.

What is a Docker Continer?

Docker Container is a unit which is created on the fly to deploy an application or a particular environment. Container uses the kernel on Host's Operating System to run multiple instances and each of the instance is called container. Each container has it's dedicated filesystem, processor and a memory asociated.

Containers v/s Virtual Machines

Alt Text

  1. Containers are more agile than VMs. Containers deploy quickly and delivers infrastructure very fast.
  2. Virtual Machines are slow and take a lot fo time to boot, on the other hand containers are fast, boot quickly and use host OS to share the relevant libraries.
  3. Containers do not waste or block resources like Virtual Machines does.

Docker Images

Docker uses the concept of Docker images to deploy the Docker Containers. Docker Images can be compaed with a template that can be used to create the Docker Containers. Docker Images are read-only templates. Docker Images are available on hub.docker.com and can also be created by users.

Installing Docker

We can use the following command to install Docker in our device.

sudo apt-get install docker.io

sudo dnf install docker-ce
Enter fullscreen mode Exit fullscreen mode

The installation of Docker can be verified by running the

docker version
Enter fullscreen mode Exit fullscreen mode

command, which returns the version of the docker.

Alt Text

Permission Denied Error

When we install Docker in our Linux device, we get the permission denied error if we run Docker without root user, to resolve the issue, we need to add the current user to the docker group.

sudo usermod -aG docker ${USER}
Enter fullscreen mode Exit fullscreen mode

Now, we need to restart our device and we can run the docker version command to see of we have the access to the Docker Engine.

Alt Text

We can test if our docker Engine is working by running the hello-world project using the command,

docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Alt Text

Now we have installed and setup the Docker in our device.

Top comments (1)

Collapse
 
nehasingh1300 profile image
Neha Singh

Thanks for sharing!
Good work