(Day 11) Task : Docker Architecture & Docker Installation :-

Aditya SharmaAditya Sharma
3 min read

Docker Architecture :-

Docker has a client-server architecture, which means it has two main parts:

  • The client that you use to type Docker commands.

  • The server (Docker engine also called the Docker Daemon) that does all the work behind the scenes.

Docker Architecture

The main parts of Docker architecture :-

1. Docker Client :

  • The interface we (the user) interact with.

  • Sends commands to the Docker Daemon.

  • Acts like a remote control.

    • Examples of commands:

        docker search <image-name>
        docker pull <image-name>
      

2. Docker Daemon (Docker Engine) :

  • The brain behind Docker.

  • Listens to Docker Client requests.

  • Builds, runs, and manages containers.

  • Runs on the host OS.

  • Can communicate with other Docker Daemons.

3. Docker Images :

  • Read-only templates used to create containers.

  • it’s a single file which contains all dependencies needed to run any program(code, libraries).

  • We can think of it as a recipe.

    • Ways to create a Docker image :

      • Using a Dockerfile :

        • You write a Dockerfile with instructions to build an image.

        • Then run docker build to create the image.

4. Docker Containers :

  • The running instances of Docker images.

  • Lightweight and portable.

  • Each container runs in isolation.

  • Think of it like a "live" app created from an image.

  • Note :- Image becomes container when run on Docker Engine.

5. Dockerfile :

  • A text file with a list of instructions to create a Docker Image.

  • Like a blueprint or recipe to make an image.

  • Example line: FROM ubuntu, COPY . /app, RUN npm install.

6. Docker Registry (Docker Hub):

  • A storage for Docker Images just like GitHub.

  • Public example: Docker Hub.

  • You can push images to it or pull images from it.

    • Two types Of Registries :-

      • Public Registry :

        • Open to everyone; anyone can pull or push images (depending on access).

        • Most popular example: Docker Hub.

        • Other public registries: GitHub Container Registry, Quay.io, etc.

      • Private Registry :

        • Restricted access; only authorized users can push/pull images.

        • Often used by companies for internal or sensitive images.

        • Can be self-hosted or cloud-based.

Docker Workflow :-

  • Create a Dockerfile: Developer writes a Dockerfile .

    Dockerfile is like a recipe for building a Docker image. It contains all dependencies & Required Softwares.

  • Docker file Executes on Docker Engine/Daemon and gives image and these images are stored in Docker Hub or Registry.

  • Execution of image makes Container .

Installing Docker :-

sudo yum install docker -y

To See all Images Present in Your Local machine :

  •   docker images
    

To Find Out Images in Docker Hub :

  •   docker search <image_name>
    

To Find Image from Docker hub to Local Machine :

  •   docker pull <image_name>
    

To Create and Start a container & we’ll reach inside Container :

  •   docker run -it --name <name-u-wanna-give> <image-name>
    

To Check service is Start or Not :

  •   service docker status
      # Or 
      docker info
    

To Start a Container & go inside Container :

  •   docker start <container_name>             # To Start Container
      docker attach <container_name>            # To Go inside Container
    

To See all containers & running Containers:

  •   docker ps -a                         # ps --> process Status While -a is all containers
      docker ps
    

To Stop Container :

  •   docker stop <container_name>
    

To Delete Container :

  •   docker rm <container_name>
    

To Stop & exit Container :

  •   exit
    
0
Subscribe to my newsletter

Read articles from Aditya Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aditya Sharma
Aditya Sharma

DevOps Enthusiast | Python | Chef | Docker | GitHub | Linux | Shell Scripting | CI/CD & Cloud Learner | AWS