/42_Inception

42 Project (Containerization using docker) setting up a small infrastructure composed of different services using docker compose

Primary LanguageShell

INCEPTION

Summary

Inception is a System Administration related exercise from the 42 curriculum. It introduces the uses of docker containerization platform through the utilization of docker compose tool, where several docker images are virtualized in a virtual machine creating various services in their own container. These services include:

  1. NGINX container with TLSv1.2 or TLSv1.3 only
  2. WordPress + php-fpm (installed and configured) container without Nginx.
  3. MariaDB container without Nginx.
  4. A volume that contains WordPress database.
  5. A volume that contains WordPress website files.
  6. A docker-network that establishes connections between these containers.

Objective

setting up a small infrastructure composed of different services using docker compose

Useful terminologies

Container

A container is a loosely isolated environment that allows building and running software packages (container images).

Container Images
Container images are packages that include the code and all dependencies to run applications quickly and reliably on any computing environment. It is the unit used to distribute applications.

Software Containerization

Software containerization is an OS virtualization method that is used to run and deploy containers without the use of Virtulal Machines (VMs).

OS Virtualization, aka Operating System-level virtualization is a method of virtualization where a single OS instance is partitioned into multiple isolated containers, each with its own user space and resource allocation, enabling efficient and lightweight virtualization of multiple virtual environments on a single host.

Docker
Docker is a software containerization platform used to develop, ship (package an application, along with the dependencies and configurations into a docker image) and run containers.
Docker Engine

The docker engine is a portion of the docker architecture that consists of several components configured as a client-server implementation where the client and server run simultaneously on the same host.

The client communicates with the server usng a REST API, which enables the client to also communicate with a remote server instance

Docker Client

The docker client are of two types:

  1. A command line application named "docker".
  2. A GUI based application named "Docker Desktop".

Both the CLI and Docker Desktop interact with a docker server and function as the primary interface to manage containers.

Docker Server

The docker server is a daemon named dockerd.

The dockerd daemon responds to requests from the client via the Docker REST API and can interact with other daemons. Dockerd is also responsible for tracking the life cycle of containers.

Docker Objects

Docker objects include networks, storage volumes, plugins

Docker Hub

Docker Hub is a Software as a Service (SaaS) docker container registry.

SaaS refers to a cloud computing model where s/w applications are provided and accessed over the internet, allowing users to utilize the application's functionalities without the need for local installation or management, typically through subscription-based or pay-per-use pricing model.

Docker registries are repositories used to store and distribute container images. It's like GitHub but only for docker images. You'll find thousands of public repositories here containing

Docker Compose

docker compose is a tool that simplifies the management of multiple docker containers allowing developers to define and orchestrate the configuration of interconnected containers as a single application using a single YAML file.

        # Sample of a docker compose file that sets up MySQL and Nginx
        version: '3'
        services:
        nginx:
            image: nginx:latest
            ports:
            - 80:80
            volumes:
            - ./nginx.conf:/etc/nginx/nginx.conf
            restart: always
    mysql:
        image: mysql:latest
        ports:
        - 3306:3306
        environment:
        - MYSQL_ROOT_PASSWORD=your_root_password
        volumes:
        - ./mysql-data:/var/lib/mysql
        restart: always

    networks:
      my-network:
        driver: bridge
Docker Network

Docker network is a virtual network that enables the communication between docker containers on the same host or across multiple hosts.

It provides an isolated environment for containers, allowing them to communicate securely and efficiently with each other. It also enables containers to interact with external networks and services.

A network driver is responsible for implementing the network features and behavior of a Docker Network. Docker provides various network drivers such as:- bridge, host, overlay, macvlan, and more.

            networks:
              my-network:
                driver: bridge
        
Docker Volumes

A docker volume is a persistent storage mechanism that allows containers to store and share data with the host machine or other containers. It is a directory or file that resides outside a container's file system and is managed by docker.

Resources