DevOps Job Ready Program

Learn • Practice • Get Hired

Docker Architecture

Introduction

Docker architecture is based on a Client–Server model that enables developers and system administrators to create, build, ship, and run applications inside containers. The main goal of Docker architecture is to provide a consistent environment where applications can run reliably across:

Docker architecture consists of three major components: Docker Client, Docker Host (Docker Engine), and Docker Registry.

Docker Architecture Overview

    Docker Client
         |
         | REST API
         |
         ↓
    Docker Daemon (Docker Engine)
         |
    --------------------
    |                  |
 Containers          Images
    |                  |
  Volumes           Networks
         |
         ↓
    Docker Registry (Docker Hub)
    

Docker Client

The Docker Client is the command-line interface (CLI) that users interact with to communicate with Docker. Users execute Docker commands through the client. Examples: docker run nginx, docker build -t myapp ., docker ps. The Docker Client sends requests to the Docker Daemon through the Docker REST API.

Responsibilities: Sends commands to Docker Engine, Manages containers, Builds images, Pulls images, Starts/Stops containers.

Docker Host

The Docker Host is the machine where Docker Engine runs (Physical Server, Virtual Machine, or Cloud Instance like AWS EC2, Azure VM, Linux Server). It contains: Docker Daemon, Containers, Images, Volumes, and Networks.

Docker Engine (Docker Daemon)

The Docker Engine is the core component responsible for managing Docker objects. The Docker Daemon runs as a background service (process: dockerd). It listens for API requests from the Docker Client.

Docker Objects

1. Docker Images

An image is a read-only template used to create containers. Contains: Application code, Libraries, Dependencies, Runtime environment.

2. Docker Containers

A container is a running instance of a Docker image.

3. Docker Volumes

Volumes provide persistent storage for containers.

4. Docker Networks

Networks allow containers to communicate with each other.

Docker Registry

A Docker Registry stores and distributes Docker images (e.g., Docker Hub). Users can upload (push) and download (pull) images.

Docker Image Workflow

Developer -> Dockerfile -> Docker Build -> Docker Image -> Docker Registry -> Docker Pull -> Docker Container.

Docker REST API

Docker Client communicates with Docker Daemon using REST API via UNIX Socket, TCP Socket, or HTTP API.

Docker Container Runtime

Docker uses containerd (lifecycle management, image transfer, storage) and runc (creating/running container processes) to execute containers.

Docker Networking Architecture

Supports Bridge Network (default), Host Network, and Overlay Network (for Swarm/Kubernetes).

Docker Storage Architecture

Uses storage drivers like Overlay2, AUFS, or Device Mapper to stack the writable container layer on top of image layers.

Docker Architecture in DevOps

Pipeline: Developer -> Git -> Jenkins CI/CD -> Docker Build -> Image -> Registry -> Kubernetes Cluster -> Production.

Docker Architecture Advantages

Real-World Example

A typical production application: Users -> Load Balancer -> Nginx Container -> (Backend Container + Database Container) -> Docker Host (AWS EC2).

Summary

Docker Architecture consists of Docker Client, Docker Engine, Docker Host, Images, Containers, Volumes, Networks, and Registry. These components work together to build, distribute, and run containerized applications efficiently.

Docker Installation Guide

Introduction

Docker installation is the process of setting up the Docker Engine on an OS (Linux, Windows, macOS, or Cloud servers). For DevOps, Linux-based installation (Ubuntu Server) is the industry standard.

Docker Components Installed

System Requirements (Linux)

RequirementSpecification
CPU64-bit Processor
RAMMinimum 2 GB
OSUbuntu 20.04/22.04/24.04
StorageMinimum 20 GB

Installing Docker on Ubuntu

Follow these essential steps:

  1. Update: sudo apt update && sudo apt upgrade -y
  2. Remove old versions: sudo apt remove docker docker-engine docker.io containerd runc
  3. Install Dependencies: sudo apt install ca-certificates curl gnupg lsb-release -y
  4. Add GPG Key & Repo: Configure Docker's official repository.
  5. Install Engine: sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Run Docker Test Container

Verify installation by running: sudo docker run hello-world

Configure Docker Without sudo

To avoid using sudo, add your user to the docker group:

    sudo usermod -aG docker $USER
    newgrp docker
    

Install on CentOS / RHEL

  1. Install utils: sudo yum install -y yum-utils
  2. Add Repo: sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  3. Install: sudo yum install docker-ce docker-ce-cli containerd.io -y

Docker Installation Verification

Use these commands to confirm health:

Docker Directory Structure

Docker stores data in /var/lib/docker/.

Docker Service Management

Use systemctl commands:

Common Docker Installation Errors

Docker Installation in DevOps

A typical DevOps server setup runs the Docker Engine on Ubuntu to host Nginx, MySQL, and application containers.

Summary

Docker installation is the foundational step for building modern DevOps, CI/CD, and Microservices-based environments.

Docker Images & Containers

Introduction

In Docker, Images and Containers are the two most important concepts.

Simple analogy: Docker Image = Application Template, Docker Container = Running Application.

What is a Docker Image?

A Docker Image is a read-only package that contains everything required to run an application, including application code, OS files, runtime environment, libraries, dependencies, and configuration files.

Characteristics of Docker Images

Read-Only: Images cannot be modified after creation; changes are stored in new layers.

Portable: The same image can run on developer laptops, testing servers, cloud servers, and production.

Layer-Based: Built using multiple layers, which allows for faster builds, image reuse, and less storage usage.

Docker Image Lifecycle

Dockerfile → docker build → Docker Image → docker run → Docker Container.

Docker Image Commands

List Images: docker images

Download from Hub: docker pull nginx

Search: docker search nginx

Remove: docker rmi nginx

Inspect: docker inspect nginx

History: docker history nginx

Creating Docker Image Using Dockerfile

A Dockerfile defines instructions to build an image.

    FROM ubuntu:22.04
    RUN apt update
    RUN apt install nginx -y
    EXPOSE 80
    CMD ["nginx","-g","daemon off;"]
    

Build image: docker build -t my-nginx .

Docker Image Tags

Tags identify different versions (e.g., nginx:latest, nginx:1.25). Command: docker tag nginx nginx:v1

Docker Registry

Stores and distributes images (e.g., Docker Hub). Commands: docker pull mysql (download), docker push username/image-name (upload).

What is a Docker Container?

A running environment created from a Docker image. It contains application process, file system, network interface, environment variables, and runtime configuration.

Characteristics of Containers

Container Lifecycle

Create → Start → Running → Stop → Remove.

Container Commands

Create: docker create nginx

Run: docker run nginx (use -d for detached mode).

List Running: docker ps

List All: docker ps -a

Stop/Start/Restart: docker stop/start/restart container_id

Remove: docker rm container_id

Logs: docker logs container_id

Access Shell: docker exec -it container_id bash

Difference Between Docker Image and Container

FeatureDocker ImageDocker Container
DefinitionBlueprintRunning instance
NatureStaticDynamic
PersistenceRead-onlyWritable layer

Image and Container Relationship

One image can create multiple containers (e.g., one Ubuntu image creating Web, DB, and API containers).

Container Writable Layer

Containers have a writable layer on top of image layers. Data in the writable layer is lost when the container is deleted. Use Volumes or Bind Mounts for permanent storage.

Docker Image vs VM

FeatureDocker ContainerVirtual Machine
SizeMBGB
StartupSecondsMinutes
OSShares Host KernelFull OS

Real-World DevOps Example

Pipeline: Git → Dockerfile → Image → Registry → Container → Production Server.

CI/CD Integration

CI/CD Pipeline: Push code to GitHub → Jenkins builds image → Pushes image → Deploys container.

Best Practices

Images: Use official images, keep small, use version tags, scan for vulnerabilities.

Containers: Use env variables, store data in volumes, monitor logs, avoid running as root.

Summary

Docker Image is the blueprint. Docker Container is the running instance. Understanding these is essential for all DevOps and Cloud Engineers.

Dockerfile Creation

Introduction to Dockerfile

A Dockerfile is a text-based configuration file that contains a set of instructions used to automatically build a Docker image. It defines the base OS, application installation steps, dependencies, environment variables, and startup commands. It acts as a blueprint for creating Docker images.

Dockerfile Naming

The default filename is simply Dockerfile. A typical project structure looks like this:

    my-web-app/
    ├── Dockerfile
    ├── index.html
    ├── app.py
    ├── requirements.txt
    └── config/
    

Basic Syntax

The general format is INSTRUCTION arguments. Example:

    FROM ubuntu:22.04
    RUN apt update
    COPY app /app
    CMD ["./app"]
    

Important Dockerfile Instructions

Creating a Simple Dockerfile

Example for an Nginx Web Server:

    FROM nginx:latest
    COPY index.html /usr/share/nginx/html/
    EXPOSE 80
    CMD ["nginx","-g","daemon off;"]
    

Build and Run

Build: docker build -t my-nginx .

Run: docker run -d -p 8080:80 my-nginx

Application Examples

Python Application: Uses FROM python:3.12, WORKDIR /app, pip install, and CMD ["python", "app.py"].

Node.js Application: Uses FROM node:20, npm install, and CMD ["npm", "start"].

Multi-Stage Builds

Used to reduce image size by separating the build environment from the production runtime.

Dockerfile Build Process

Developer Code → Dockerfile → Build → Image Layers → Docker Image → Container.

Best Practices

Dockerfile Debugging

Use docker history image_name to view layers, docker inspect to check details, and docker exec -it container_id bash to enter a running container.

Dockerfile in DevOps Pipeline

GitHub → Jenkins Pipeline → Build Image → Push to Docker Hub → Deploy Container.

Summary

A Dockerfile automates the installation and packaging of applications. Mastering it is essential for DevOps Engineers, Cloud Engineers, and CI/CD professionals.

Docker Volumes

Introduction to Docker Volumes

Docker Volumes are a storage mechanism used to persist data generated and used by Docker containers. By default, data inside a container exists only in the writable layer and is lost when the container is removed. Docker Volumes solve this by storing data outside the container lifecycle.

Why Do We Need Docker Volumes?

Containers are temporary. Without a volume, database data or application logs are deleted when a container is removed. Volumes are essential for database storage, application data, logs, configuration files, and backups.

Docker Storage Architecture

Docker uses a layered architecture where the container's writable layer sits on top of read-only image layers, while volume mounts provide a bypass for persistent data storage.

Types of Docker Storage

Docker Volume Architecture

Creating Docker Volumes

Create: docker volume create database-data

List: docker volume ls

Inspect: docker volume inspect database-data

Remove: docker volume rm database-data or docker volume prune for unused.

Using Volumes with Containers

Use the -v flag to attach a volume:

    docker run -d --name mysql-db \
    -v mysql-data:/var/lib/mysql \
    mysql
    

Bind Mounts

Connects a host directory to a container directory:

    docker run -v /home/user/project:/app nginx
    

Docker Volume vs Bind Mount

FeatureDocker VolumeBind Mount
Managed by DockerYesNo
LocationDocker directoryUser-defined
Production UseRecommendedDev use

Volumes in Docker Compose

    services:
      database:
        image: mysql
        volumes:
          - mysql-data:/var/lib/mysql
    volumes:
      mysql-data:
    

Sharing Volumes Between Containers

Multiple containers can mount the same volume, allowing shared access to data files or logs.

Backup & Restore

Back up data by mounting the volume to a temporary Ubuntu container and running tar commands to archive the data to the host.

Security Best Practices

Docker Volumes in Cloud Environments

In production (AWS, Azure, etc.), volumes often map to cloud-native storage like AWS EBS, ensuring data persists even if the EC2 instance is rebooted or replaced.

Docker Volume Interview Questions

Common questions: What is a volume? Where are they stored? How are they different from bind mounts? Which one is recommended for production?

Summary

Docker Volumes decouple data from the container lifecycle, ensuring application data remains safe even if containers are stopped or deleted. They are a fundamental building block for production-grade DevOps environments.

Docker Networking

Definition & Importance

Docker Networking enables communication between containers, the host, and external networks. It provides isolation, security, and connectivity.

Why is it required? It allows container-to-container communication within an application stack, supports distributed applications, and secures environments by isolating services.

Network Architecture

Docker uses a virtual networking layer called CNM (Container Network Model) to manage how containers connect to each other and the outside world.

Network Components

Docker Network Drivers

Port Mapping

To access an isolated container from the outside world, you use port mapping: docker run -p [HostPort]:[ContainerPort] nginx.

Docker DNS Service Discovery

Docker provides automatic DNS resolution. Containers can communicate using their container names instead of IP addresses within a custom bridge network (e.g., mysql:3306).

Docker Network Commands

Docker Compose Networking

Docker Compose automatically creates a network for your services, allowing them to communicate via service names defined in the docker-compose.yml file.

Best Practices

Real-World DevOps Example

In production, traffic flows through a Load Balancer to an Nginx container (Frontend Network), which talks to an Application container (Backend Network), which finally accesses a Database container (Database Network).

Summary Table

Network TypePurpose
BridgeDefault, single-host communication
HostHigh-performance, no isolation
NoneComplete network isolation
OverlayMulti-host container communication
MacvlanPhysical network integration

Docker Compose

Definition & Purpose

Docker Compose is a tool used to define, configure, and manage multi-container applications using a YAML configuration file (compose.yaml or docker-compose.yml). It replaces manual docker run commands with a single automated configuration.

Benefits: Manages multi-container stacks, automates deployments, simplifies networking/volumes, and creates reproducible development environments.

Docker Compose Architecture

Compose takes your configuration file and manages the entire lifecycle of services, networks, and volumes as a single unit.

File Structure

Commonly named docker-compose.yml. A simple example:

    version: "3.8"
    services:
      web:
        image: nginx
        ports:
          - "8080:80"
      database:
        image: mysql
        environment:
          MYSQL_ROOT_PASSWORD: password
    

Main Components

Useful Commands

Start: docker compose up -d (Run in background)

Stop: docker compose down

Logs: docker compose logs -f

Status: docker compose ps

Real-World Example (WordPress)

A WordPress stack links a wordpress container to a mysql container using internal networking, with persistent data managed via Volumes.

Networking & Scaling

Compose creates a default private network for all services, allowing them to communicate via service names (e.g., mysql:3306). You can also scale services easily: docker compose up --scale web=3.

.env Configuration

Keep sensitive data out of the YAML file by using a .env file. Access variables in the compose file using ${VARIABLE_NAME}.

Docker Run vs Compose

FeatureDocker RunDocker Compose
ScaleSingle containerMultiple containers
ConfigCommand-basedYAML-based
ManagementManualAutomated

Docker Compose in DevOps

Docker Compose is widely used in development environments and CI/CD pipelines to spin up entire application stacks for integration testing before deploying to production (Kubernetes/Swarm).

Best Practices

Summary

Docker Compose is essential for managing multi-container microservices. It transforms complex manual deployments into a single, declarative YAML configuration, making it a cornerstone skill for DevOps engineers.

Docker Multi-Stage Builds

Definition

Docker Multi-Stage Builds is a technique that allows you to use multiple FROM statements in a single Dockerfile. You create different stages for building and copying only the required final output into a clean runtime image.

Why Multi-Stage Builds Are Needed?

Traditional builds include compilers, source code, and build tools, leading to large images and security risks. Multi-stage builds separate the Build Environment from the Production Environment, ensuring only necessary files exist in the final image.

Multi-Stage Build Architecture

The build stage compiles the code, and the final production stage takes only the binary or static files, leaving behind the heavy tools.

Basic Syntax

    FROM image AS stage-name
    # Build instructions
    FROM another-image
    COPY --from=stage-name files destination
    

Node.js Application Example

Instead of keeping the entire Node source and build tools, you build the app and copy only the final dist folder into a lightweight Nginx image.

Java Application Example

Use a maven image to compile the source into a .jar file, then copy that .jar into a lightweight openjdk runtime image.

Go Application Example

Go apps are perfect for this: use a golang image to compile the binary, then copy it into an alpine image, resulting in a tiny, secure executable.

Naming Build Stages

You can name stages (e.g., FROM ubuntu AS development) to make the Dockerfile more readable and to target specific stages during the build process using --target.

Multi-Stage Build with Testing

You can add a test stage in the Dockerfile. If the tests fail, the image build fails, ensuring only tested code reaches the production stage.

Advantages

Best Practices

Multi-Stage Build in DevOps

The workflow moves from Git Repository → Docker Build → Testing Stage → Production Image → Registry → Kubernetes Deployment.

Multi-Stage Build vs Single-Stage

FeatureSingle StageMulti Stage
Image SizeLargeSmall
SecurityLowerHigher
Production ReadyLess optimizedHighly optimized

Summary

Multi-stage builds are essential for creating optimized, secure, and production-ready images. They are a mandatory skill for modern DevOps engineering.

Question & Answer

Fundamentals

1. What is Docker?

Docker is an open-source containerization platform used to develop, package, deploy, and run applications inside lightweight containers.

2. What is Containerization?

Containerization is a technology that packages an application and its dependencies into a portable container that can run consistently across different environments.

3. What is a Docker Container?

A Docker container is a lightweight, isolated execution environment that contains an application, libraries, dependencies, and configuration files.

4. What is the difference between Containers and Virtual Machines?
FeatureContainersVirtual Machines
OSShare host OS kernelHave their own OS
WeightLightweightHeavyweight
StartupFaster startupSlower startup
ResourcesLess resource usageMore resource usage
5. What are the main advantages of Docker?

Key advantages include: Portability, Fast deployment, Application isolation, Resource efficiency, Easy scaling, and Consistent environments.

6. What is Docker Engine?

Docker Engine is the core runtime responsible for creating, managing, and running Docker containers.

7. What are the main components of Docker Architecture?

Docker architecture contains: Docker Client, Docker Host, Docker Daemon, Docker Images, Docker Containers, and Docker Registry.

8. What is Docker Client?

Docker Client is a command-line interface (CLI) used to communicate with the Docker daemon. Example: docker run nginx

9. What is Docker Daemon?

Docker Daemon is a background service (dockerd) that manages Docker objects such as containers, images, networks, and volumes.

10. What is Docker Host?

Docker Host is the machine (physical, virtual, or cloud instance) where Docker Engine runs and containers are created.

Images & Registry

11. What is a Docker Image?

A Docker image is a read-only template used to create Docker containers. Think of it as a snapshot or a blueprint of your application.

12. What is the difference between Docker Image and Container?
FeatureImageContainer
DefinitionBlueprintRunning instance
NatureStaticDynamic
StorageRead-onlyRead/write layer
13. What is Docker Hub?

Docker Hub is a public container registry where users can store, share, and download Docker images.

14. What is a Docker Registry?

A Docker Registry is a storage system used to store and distribute Docker images. Examples: Docker Hub, Amazon ECR, and Google Container Registry.

15. How do you download an image from Docker Hub?

Use the docker pull <image-name> command. Example: docker pull nginx

16. How do you list Docker images?

Use the docker images command.

17. How do you remove a Docker image?

Use the docker rmi <image-name> command.

18. What is an image tag?

An image tag identifies a specific version of a Docker image. Example: nginx:1.27

19. What is the latest tag in Docker?

latest is the default tag used when no specific version is provided (e.g., docker pull nginx is the same as docker pull nginx:latest).

20. How do you create a Docker image?

You use a Dockerfile and the build command: docker build -t myimage .

Containers

21. How do you create a Docker container?

Use the docker run command. Example: docker run nginx

22. How do you list running containers?

Use the docker ps command.

23. How do you list all containers (including stopped ones)?

Use the docker ps -a command.

24. How do you stop a container?

Use the command: docker stop container-name

25. How do you start a stopped container?

Use the command: docker start container-name

26. How do you restart a container?

Use the command: docker restart container-name

27. How do you remove a container?

Use the command: docker rm container-name

28. How do you view container logs?

Use the command: docker logs container-name

29. How do you access a running container?

You can use the docker exec -it container-name bash command to get an interactive shell inside the container.

30. What is the container lifecycle?

The container lifecycle describes the states a container goes through during its existence:

Create → Start → Running → Stop → Remove

Dockerfile

31. What is a Dockerfile?

A Dockerfile is a text file that contains a series of instructions used to automate the building of a Docker image.

32. What is the FROM instruction?

FROM defines the base image to start your build process. Example: FROM ubuntu

33. What is the RUN instruction?

RUN executes commands in a new layer on top of the current image and commits the results. Example: RUN apt update

34. What is the COPY instruction?

COPY transfers files and directories from your local host machine into the filesystem of the container. Example: COPY app /app

35. What is the CMD instruction?

CMD provides default arguments or commands for the container to execute when it starts. Example: CMD ["nginx"]

36. What is ENTRYPOINT?

ENTRYPOINT configures a container that will run as an executable. It ensures the container always runs a specific process.

37. What is the difference between CMD and ENTRYPOINT?
FeatureCMDENTRYPOINT
OverrideCan be overridden via command lineDifficult to override
RoleDefault command/argumentsMain container process
38. What is EXPOSE in Dockerfile?

EXPOSE acts as documentation to inform the user which ports the container listens on at runtime. Example: EXPOSE 80

39. What is WORKDIR?

WORKDIR sets the working directory for any RUN, CMD, ENTRYPOINT, COPY, and ADD instructions that follow. Example: WORKDIR /app

40. What is .dockerignore?

A .dockerignore file prevents large or unnecessary files (like .git or local logs) from being copied into your image, keeping it smaller and more secure.

Networking & Volumes

41. What is Docker Networking?

Docker Networking provides the infrastructure to allow containers to communicate securely with each other, with the host machine, and with external networks.

42. What is the default Docker network?

The default network is the Bridge network.

43. What are Docker network drivers?

Drivers determine how containers connect to the network. Common drivers include: Bridge, Host, None, Overlay, and Macvlan.

44. How do you create a Docker network?

Use the command: docker network create <network-name>

45. What is bridge networking?

Bridge networking acts as a virtual switch, allowing containers running on the same Docker host to talk to each other over a private network.

46. What is host networking?

Host networking removes the network isolation between the container and the Docker host. The container shares the host's networking namespace directly.

47. What is overlay networking?

Overlay networking enables communication between containers that are running on different Docker hosts. It is widely used in Docker Swarm and Kubernetes clusters.

48. What is port mapping?

Port mapping (or publishing) maps a port on the host machine to a port inside the container.
Example: docker run -p 8080:80 nginx (Maps host port 8080 to container port 80).

49. How do containers communicate?

Containers communicate using Docker networks and internal DNS names. You can ping one container from another by its name if they are in the same user-defined bridge network.

50. What is Docker DNS?

Docker has an internal DNS server that automatically resolves container names into their respective internal IP addresses, making inter-container communication easy and dynamic.

51. What are Docker Volumes?

Docker volumes provide persistent storage for containers, ensuring data survives even after a container is removed.

52. Why are Docker volumes required?

Volumes prevent data loss when containers are deleted, allowing data to be shared and reused across containers.

53. How do you create a volume?

Command: docker volume create data

54. How do you list volumes?

Command: docker volume ls

55. How do you remove a volume?

Command: docker volume rm <volume-name>

56. Difference between Volume and Bind Mount?
FeatureVolumeBind Mount
ManagementManaged by DockerManaged by user
UsageBetter for productionBetter for development

Compose & Orchestration

57. What is Docker Compose?

Docker Compose is a tool used to define and manage multi-container applications using a single YAML file.

58. What file is used by Docker Compose?

It typically uses docker-compose.yml or compose.yaml.

59. How do you start Docker Compose?

Command: docker compose up

60. How do you stop Docker Compose?

Command: docker compose down

61. What are services in Docker Compose?

Services define the individual containers (e.g., web server, database) that make up your application stack.

62. What is depends_on?

It defines the dependency order between services, ensuring a database starts before the application that requires it.

Security & DevOps

63. What are Docker Multi-Stage Builds?

A technique used to create smaller, more efficient Docker images by using multiple FROM statements in a single Dockerfile. Each stage can use different base images, discarding unnecessary build tools in the final image.

64. Why use Multi-Stage Builds?

They provide:

  • Smaller image sizes: Only the final artifacts are kept.
  • Better security: Build dependencies aren't included in the final image.
  • Faster deployment: Smaller images transfer faster over the network.

65. What is the AS keyword in Dockerfile?

The AS keyword is used to name a build stage, making it easier to reference that stage later in the Dockerfile. Example: FROM node AS builder

66. Why is Docker Security important?

It protects your containers, images, the host OS, and the applications themselves from unauthorized access and malicious attacks.

67. Why avoid running containers as root?

Running as root increases security risks; if a container is compromised, the attacker may gain root access to the host. It is best practice to use a non-privileged user.

68. What is Docker image scanning?

It is the process of analyzing Docker images to detect security vulnerabilities in dependencies. Common tools include Trivy and Docker Scout.

69. What are Docker secrets?

Secrets are a secure way to store sensitive information like database passwords, API keys, or certificates without hardcoding them in images.

70. What is a privileged container?

A privileged container has extended access to host resources (like hardware devices), which can be dangerous if not strictly managed.

71. What is Amazon ECR?

Amazon Elastic Container Registry (ECR) is a fully-managed AWS private container registry that makes it easy to store, manage, and deploy container images.

72. What is Docker Hub used for?

Docker Hub is the primary public repository used to store and distribute Docker images to the global developer community.

73. How do you push an image?

Command: docker push <image-name>

74. How do you pull an image?

Command: docker pull <image-name>

75. How do you check the Docker version?

docker version

76. How do you check Docker system information?

docker info

77. How do you inspect a container?

docker inspect <container-name> (Provides detailed metadata about the container).

78. How do you check container resource usage?

docker stats (Shows CPU, memory, and network usage in real-time).

79. How do you copy files from a container?

docker cp <container-id>:<path-in-container> <host-path>

80. How do you clean unused Docker objects?

docker system prune (Removes unused containers, networks, and dangling images).

81. What is Docker Swarm?

Docker's native container orchestration tool used to manage a cluster of Docker hosts.

82. What is Kubernetes?

An open-source orchestration platform for automating deployment, scaling, and management of containerized applications.

83. Docker vs Kubernetes?

Docker: Focuses on creating and running containers on a single host.
Kubernetes: Focuses on managing and orchestrating those containers across large clusters.

84. What is container orchestration?

The automated management, scaling, networking, and deployment of many containers in a distributed environment.

85. What is Docker Health Check?

A mechanism to monitor if a container is still running correctly, enabling automatic restarts if the process fails.

86. What is Docker Restart Policy?

It defines if and when a container should restart automatically (e.g., --restart always).

87. What is Docker Layer?

Every instruction in a Dockerfile creates a read-only layer. These layers are stacked to form the final image.

88. What is Docker Cache?

Docker caches each build step. If a step hasn't changed, Docker reuses the layer from cache to significantly speed up build times.

89. What is Docker Registry Authentication?

The process of logging in (docker login) to verify your credentials before pulling or pushing private images.

90. What is Docker CI/CD Integration?

It involves automating the pipeline where code changes are automatically built into Docker images, tested, and deployed to staging or production environments.

91. How is Docker used in DevOps?

Docker provides a consistent environment across all development stages, ensuring that "it works on my machine" translates to "it works in production."

92. How is Docker used with Jenkins?

Jenkins uses the Docker engine to pull source code, build Docker images, and deploy containers as part of an automated pipeline.

93. How is Docker used with Kubernetes?

Kubernetes takes the containers built by Docker and handles their orchestration, high availability, and scaling across a production cluster.

94. What is container scaling?

The ability to automatically add (scale-out) or remove (scale-in) container instances based on current traffic and resource demand.

95. What is container monitoring?

The process of observing the health, logs, and performance metrics of running containers to ensure system reliability.

96. Name Docker monitoring tools.

Common tools include Prometheus (metrics), Grafana (visualization), ELK Stack (logs), and CloudWatch (AWS monitoring).

97. What is Docker image optimization?

The practice of reducing image size and attack surface by using multi-stage builds, removing unnecessary dependencies, and selecting lightweight base images like Alpine Linux.

98. What are Docker best practices?

Use small base images, scan images for vulnerabilities, secure sensitive data (secrets), use persistent volumes, and never run containers as the root user.

99. Why is Docker popular in Cloud environments?

It enables cloud-native development, providing extreme portability, scalability, and faster deployment times across AWS, Azure, and Google Cloud.

100. What is the future of Docker Containerization?

Docker continues to be the bedrock of modern microservices, Kubernetes, and hybrid-cloud architectures, evolving toward even tighter integration with security and automation tools.