Skip to main content

Command Palette

Search for a command to run...

Docker

Updated
3 min read
Docker
A

As a MERN developer, I specialize in building web applications using the MERN stack, which includes MongoDB, Express.js, React.js, and Node.js. With extensive skills in developing scalable and robust web applications, I am committed to delivering high-quality solutions that meet the needs of my clients.

Introduction

Docker is an environment for developing, shipping and running an application in containers. Docker provides a way to create, deploy, and manage containers efficiently, making it easier to build and deploy software across different environments consistently.

WSL

WSL stands for Windows Subsystem for Linux. It provides an environment that allows us to run Linux tools and programs inside Windows. Once you install WSL, which provides us with a bash terminal, where we can run Linux commands within our Windows OS.
Steps to enable WSL in Windows:

  1. Go to the "Windows turn feature off and on" section in your system.

  2. Tick on Windows Subsystem for Linux and save.

  3. Then Restart your PC.

  4. After restarting Windows go to Microsoft Store and install one of the Linux App (e.g.: Ubuntu 22.0 LTS)

  5. After installing then open open it. If any error occurs then follow the instructions shown

  6. Then set up your Linux system username and password. (Note username and password should not coincide with your Windows username or password)

  7. Then enjoy your Linux subsystem inside Windows.

After setting up WSL you can install docker from bash otherwise you can download docker desktop directly into your system.

Containers

It is a way to package an application with all the necessary dependencies and configuration. These packages can be easily shared and moved between development teams.

This package of containers makes the development environment more efficient.

Where do containers live?

Containers live in the container repository. So it is a special type of storage for containers.
Many companies have their own repository which is known as a private repository.
There is also a public repository for the docker. Docker Hub is a public repository for docker.

How do containers improve development?

Before docker to develop an application with multiple teams. They run their application on different machine, the services required to set up an environment for the application is also different and there are many steps to set up an application environment which is reduced by containerized concept. Manual setup for an application can be very tedious and time-consuming resulting in loss of time and effort.

After Docker, you do not have to install any services or dependencies manually on your local machine. Because the container has its own isolated environment. With a based image that provides an isolated environment with everything packaged. Rather developer go and install services for application, developer checks containers to find specific container and download on his local machine.

How container environment help in the deployment process?

Before Container

  • Configuration on the server needed

  • Conflicts may occur in dependency version

  • Misunderstanding between developer and operation team

  • The developer needs to mention the operation of the configuration.

After Container

  • Developers and operations work together to package applications in a container

  • No environmental configuration is needed on the server except docker runtime

  • The only thing you need to do is to run docker command. So it is a one-time effort.

Docker Image vs Docker Container

Docker ImageDocker Container
Actual packageActually, start the application
Artifact that can be moved aroundA container environment is created.
Image run on containerIt is a running environment for image