Let's look at Docker

Let's look at Docker

What is Docker?

  • Docker is an open platform for developing, shipping, and running applications.
  • You may separate your applications from your infrastructure with the help of Docker, allows for quick software delivery.
  • You can manage your infrastructure using Docker in the same manner that you manage your applications.
  • You may significantly shorten the time between writing code and running it in production by using Docker's methodology for shipping, testing, and deploying code quickly.

Docker is written in the Go programming language and takes advantage of several features of the Linux kernel to deliver its functionality.

Why would you need to use Docker?

  • Fast, consistent delivery of your applications.
  • Responsive deployment and scaling.
  • Running more workloads on the same hardware.

What is a Container?

  • A way to package an application with all the necessary dependencies and configuration.
  • Portable artifact, easily shared and move around.
  • Makes development and deployment more efficient.

Where do Containers live?

  • Container Repository - A container repository is a group of connected container images that are used to provide various applications.
  • Private Repository - Private repositories let you keep container images private, either to your own account or within an organization or team.
  • Public Repository - Public repositories can be used to host Docker images which can be used by everyone else. Example-Docker Hub

Developers and Operations work together to package the application in a container.

Containers vs Virtual Machines

  • VM provides complete isolation from the host operating system and other VMs.

    • Container provides lightweight isolation from the host and other containers, but doesn't provide as strong a security boundary as a VM.
  • VM runs a complete operating system including the kernel, thus requiring more system resources.

    • Container runs an operating system's user mode and can be configured to only run the services that your app actually needs, consuming less system resources.
  • VM runs just about any operating system inside the virtual machine.

    • Container runs on the same operating system version as the host.


  • Install Docker Desktop on Mac Here.
  • Install Docker Desktop on Windows Here.
  • Install Docker Desktop on Linux Here.


Docker Engine

The following are the parts that are included in Docker Engine:

  • Docker Daemon

    • It is a background process that manages Docker Objects such as the images, containers, volumes and networks. To run the daemon, you type dockerd.
    • The Docker daemon's responsibility is to monitor and continuously handle API requests that are made of it.

    • As suggested by the name, it refers to a particular API that applications utilize to interface or communicate with the Docker daemon.
    • REST API can be accessed with an HTTP client.
    • The Docker daemon receives instructions from this API on how to operate within the engine and architecture.
  • Docker CLI

    • Command Line Interface that interacts with docker daemon.
    • Docker CLI simplifies the way you manage the instances of your container.

Docker Architecture

  • Docker is a client-server architecture.
  • The entire docker architecture comprises four major components:
    • Docker Client
    • Docker Registry
    • Docker Host
    • Docker Objects

Docker Client

  • The Docker Client component is the element that enables the developers or users to interact with the Docker platform.
  • The Docker Client can be present over the same host as that of the Docker daemon. If not that, the client can also connect to the daemon that is available upon a remote host.
  • A docker client intends to communicate with one or more daemon.

Docker Registries

  • Docker Registries are more like the location where all the Docker Images are stored.
  • There is no barrier to the registries being either public or private docker registries.
  • The developers can create their own private registries with ideal measures.
  • Docker Hub is one default registry of the platform that has a stock of docker images. It is public and is accessible to all.

Docker Host

  • Docker Host intends to offer an environment that is ready for running and executing the applications.
  • Docker Host comprises docker images, daemon, Networks, Storage, and Containers. - Host networking has a different set of advantages for Docker Host and the platform as a whole.

Docker Objects


  • An image is a read-only template with instructions for creating a Docker container.
  • A docker image is described in a text file called a Dockerfile, which has a simple, well-defined syntax.
  • An image does not have states and never changes.
  • Docker Engine provides the core Docker technology that enables images and containers.
  • Docker Images proposes a collaboration between developers and the docker containers.
  • Docker images can be called or pulled from a public or private registry.
  • You can create a docker file that contains a variety of instructions and use it to create docker images.
  • The base layer of a docker image is read-only, while the top-most layer is open to be written by developers. Remember, every time you edit one dockerfile, rebuild and remodify it; only the part that is modified will be rebuilt over the top layer of docker image.


  • A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
  • This file can be used to create Docker Image.
  • These images can be pulled to create containers in any environment.
  • When you run docker image, you get docker containers.

Example of a Dockerfile:

FROM Ubuntu
RUN apt-get update
RUN apt-get install python
RUN pip install flask
RUN install flask-mysql
COPY ./opt/source-code
ENTRYPOINT FLASK_APP=/opt/source-code/app.py

How to create your own Docker Image
  • Create a Docker file named DockerFile for example, and write instructions for setting up our application.
  • Build your Image using the docker build command and specify the docker build command and specify the docker file as input as well as a tag name for the image. docker build DockerFile -t barkatul/my-app
  • To make it available on Docker registry, use docker push barkatul/my-app


  • A runnable instance of an image is known as a container.
  • Your application is now running here. Container management is possible with the Docker API or CLI.
  • You can attach storage to a container, connect it to one or more networks, or even construct a new image depending on the state of the existing one.


  • Docker Networking allows you to create a Network of Docker containers managed by a master node called manager.
  • Container inside the docker can talk to each other by sharing packets of information. They can talk to each other using just the container name (without localhost, port no. , etc.) because they are in the same network.
  • The applications that run outside of Docker are going to connect to them from outside from the host using local host and the port No.


It explains your ability to store the data within the layer of the container that is writable. But for that, you will need a storage driver. The storage is non-persistent, for which the data will perish anytime the container is not under the run. In terms of persistent storage, Docker intends to offer few options that include:

  • Data Volumes
  • Data Volume Container
  • Directory Mounts
  • Storage Plugins


  • docker version – Echoes Client’s and Server’s Version of Docker
  • docker images – List all Docker images
  • docker build <image> – Builds an image from a Docker file
  • docker save <path> <image> – Saves Docker image to .tar file specified by path
  • docker run – Runs a command in a new container.
  • docker start – Starts one or more stopped containers
  • docker stop <container_id> – Stops container
  • docker rmi <image> – Removes Docker image
  • docker rm <container_id> – Removes Container
  • docker pull – Pulls an image or a repository from a registry
  • docker push – Pushes an image or a repository to a registry
  • docker export – Exports a container’s filesystem as a tar archive
  • docker exec – Runs a command in a run-time container
  • docker ps – Show running containers
  • docker ps -a – Show all containers
  • docker ps -l – Show latest created container
  • docker search – Searches the Docker Hub for images
  • docker attach – Attaches to a running container
  • docker commit – Creates a new image from a container’s changes
  • docker network ls
  • docker network create *network_name*


  • docker build java-application - builds a java-application image.
  • docker pull redis - pulls the redis image (the latest version).
  • docker run redis - runs the redis image as a container.
  • docker run redis:4.0 - runs the redis image (version 4.0) as a container.
  • docker run -d redis runs the redis image as a container in a detached mode.

Note: docker run creates a new Container, while docker start restart a stopped container.


Kunal Kushwaha

Thank you for a reading mate, If you find this article useful, please like, comment, and share it.

Connect with me on :

Did you find this article valuable?

Support WeMakeDevs by becoming a sponsor. Any amount is appreciated!