Docker: Introduction

Docker: Introduction

INTRODUCTION

At the beginning when computers were just starting to really pick up, organizations could not run applications without having to initially buy servers; however there was an issue with this, you could only run one application on a server. So if you wanted to run 2-6 applications, you would have to buy that many servers, ultimately this was a problem for both the company and the environment in the long run.

WHAT IS DOCKER

Docker is an open-source platform widely used by software companies that facilitates the shipment of applications quickly. It allows developers to be able to package all the dependencies, libraries, and possible configurations into a single package that can either be shared as an image (Docker image) or deployed as an instance called a container (Docker container).

It is an alternative to virtual machines which allows you to run different operating systems on one computer. In this article, I will be introducing docker, it difference between a virtual machine, and benefits of using Docker.

In simpler words, Docker lets you run your operating system as a container.

Docker Engine

Docker Engine.avif

Docker Engine is the layer on which Docker runs and it is installed on the host machine. It’s got a lightweight runtime and tooling that manages containers, images, builds, and more. Docker Engine acts as a client-server application with:

  • A command line interface (CLI) client docker.
  • Rest APIs which specify interfaces that programs can use to talk to and instruct the Docker daemon.

DOCKER TERMINOLOGIES

Docker Client It is what we use to interact with Docker. You can think of it like the user interface for Docker. Whenever you type in a command, the client sends these to the daemon.

Docker CLI It allows users to issue commands to the Docker Daemon. Docker uses a client – server architecture. Docker Daemon It is the heart of the Docker architecture, which does the crucial work of building, running, and distributing the containers. It also manages the Docker images and the containers.

Docker Image The file that contains the source code, operating system files to run the application along with its other dependencies inside the container is called Docker image. A containerized application is the running instance of an image. Docker images are immutable.

Docker Registries This is where Docker images are stored. Docker hub is the official online public repository of Docker where you can find all the images of popular applications. Docker hub also allows us to create our own images for our application.

Docker File It contains the list of instructions to create Docker images.

Setting up Docker on Windows

In this section, we shall be going through the process of setting up Docker on Windows.

To use Docker on Windows, some requirements must be met.

A 64-bit operating system must be installed Minimum of 4GB installed RAM Virtualization must be enabled in your laptop’s BIOS (the process to enable this varies between products, ensure to check with your product’s manufacturer)

  • Follow these steps to set up Docker:

You can refer the official documentation to get started.

If you want to skip installation, you can head to Play With Docker, an interactive online playground for Docker.

Basic Docker Commands

  • docker -version This command is used to get the currently installed version of docker.

  • docker run -it -d This command is used to create a container from an image.

  • docker ps :This command is used to list the running containers

  • docker ps -a :This command is used to show all the running and exited containers

  • docker stop :This command stops a running container

  • docker kill ":This command kills the container by stopping its execution immediately

  • docker pull :This command is used to pull images from the docker repository

  • docker push :This command is used to push an image to the docker hub repository

BENEFITS OF USING DOCKER

  • Scalability

You can quickly create new containers if demand for your applications requires them. When using multiple containers you can take advantage of a range of container management options. See the Docker documentation for more information on these options.

  • Rapid Deployment Docker-powered containers are known for decreasing deployment time to seconds. This is due to the fact that it creates a container for every process and does not boot an OS. Data can be created and destroyed without worry that the cost to bring it up again would be higher than what is affordable.
  • It makes it easy to run multiple versions of the same application without configuration conflicts.

FURTHER READING

Docker Overview

Docker vs Virtual Machine