This project has been created as part of the 42 curriculum by shrimech.
Inception is a system administration project from the 42 curriculum focused on containerization, Docker, networking, volumes, environment configuration, and service orchestration.
The goal of this project is to build a small infrastructure composed of multiple services running inside separate Docker containers. Each service is built from a custom Dockerfile and orchestrated using Docker Compose.
The infrastructure includes:
- NGINX — acts as the entry point of the infrastructure and provides HTTPS access using TLS.
- WordPress + PHP-FPM — provides the website and application layer.
- MariaDB — stores the WordPress database.
- Docker volumes — provide persistent storage for the database and WordPress files.
- Docker networks — allow containers to communicate with each other in an isolated environment.
- Docker secrets — store sensitive information such as database passwords outside environment variables.
The project is designed to demonstrate how multiple isolated services can work together to form a complete infrastructure.
The architecture can be represented as follows:
Internet / Browser
│
│ HTTPS
▼
┌──────────────┐
│ NGINX │
│ :443 only │
└──────┬───────┘
│
│ Docker Network
▼
┌──────────────┐
│ WordPress │
│ PHP-FPM │
└──────┬───────┘
│
│ Docker Network
▼
┌──────────────┐
│ MariaDB │
└──────────────┘
Persistent Data
┌──────────────────────────┐
│ Docker Volumes │
│ │
│ • WordPress files │
│ • MariaDB database │
└──────────────────────────┘
.
├── Makefile
├── README.md
├── secrets
│ ├── credentials.txt
│ ├── db_password.txt
│ └── db_root_password.txt
│
└── srcs
├── .env
├── docker-compose.yml
│
└── requirements
├── bonus/
├── mariadb/
│ ├── conf/
│ ├── tools/
│ ├── Dockerfile
│ └── .dockerignore
│
├── nginx/
│ ├── conf/
│ ├── tools/
│ ├── Dockerfile
│ └── .dockerignore
│
└── wordpress/
├── conf/
├── tools/
├── Dockerfile
└── .dockerignore
The project requires:
- Docker
- Docker Compose
- GNU Make
You can verify that Docker and Docker Compose are installed with:
docker --version
docker compose versionBefore starting the infrastructure, configure the environment variables inside:
srcs/.env
Example:
DOMAIN_NAME=shrimech.42.fr
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpressSensitive credentials are stored in the secrets/ directory.
Example:
secrets/
├── credentials.txt
├── db_password.txt
└── db_root_password.txt
These files should contain the required credentials without exposing them directly inside Dockerfiles or Docker Compose configuration.
From the root of the repository:
makeor:
make allThis builds the Docker images and starts the infrastructure.
The containers can also be started manually using Docker Compose:
cd srcs
docker compose up --buildTo run the containers in detached mode:
docker compose up -d --buildTo stop the containers:
make downOr manually:
cd srcs
docker compose downDepending on the implementation of the Makefile, the following commands can be used:
make cleanTo remove containers, images, volumes, and networks:
make fcleanThe exact behavior of
cleanandfcleandepends on the implementation of the project's Makefile.
Docker is used to isolate each service into its own container.
Instead of installing NGINX, WordPress, PHP-FPM, and MariaDB directly on the host machine, each service runs in an independent environment with its own configuration.
Each service has its own:
- Dockerfile
- Configuration files
- Startup scripts
- Dependencies
The services are orchestrated using Docker Compose.
This approach makes the infrastructure reproducible: the same configuration can be built and executed on another compatible system.
The project contains custom Docker configurations for the main services:
NGINX acts as the public entry point.
Its responsibilities include:
- Listening on port
443 - Handling HTTPS connections
- Managing TLS certificates
- Forwarding PHP requests to the WordPress PHP-FPM service
NGINX is the only service directly exposed to the outside network.
WordPress provides the web application.
The WordPress container uses PHP-FPM instead of running its own web server.
It communicates with:
- NGINX for incoming requests
- MariaDB for database access
WordPress files are stored in a persistent Docker volume.
MariaDB provides the database service used by WordPress.
The database stores:
- WordPress users
- Posts
- Configuration
- Application data
MariaDB data is stored in a persistent Docker volume so that the data survives container recreation.
Each major service runs in its own container:
- NGINX
- WordPress
- MariaDB
This separation improves:
- Isolation
- Maintainability
- Portability
- Scalability
Each container has a specific responsibility.
For example, NGINX handles HTTP/HTTPS traffic, while MariaDB only handles database operations.
The images are built using custom Dockerfiles rather than using pre-built service images directly.
This makes the configuration explicit and allows the infrastructure to control:
- Installed packages
- Configuration files
- Startup behavior
- Permissions
- Environment configuration
Docker volumes are used to store data that must survive container deletion.
Two important types of persistent data are:
- WordPress files
- MariaDB database files
Without persistent storage, recreating a container could result in data loss.
The containers communicate through a Docker network.
Docker provides internal DNS resolution, allowing services to communicate using service names.
For example:
WordPress → mariadb
NGINX → wordpress
The containers do not need to expose all internal ports to the host machine.
Only the required public service is exposed.
A Virtual Machine emulates a complete operating system environment.
A VM typically contains:
Hardware
│
Hypervisor
│
Guest Operating System
│
Applications
Each VM has its own:
- Operating system
- Kernel
- System libraries
- Applications
Docker containers share the host kernel.
Hardware
│
Host Operating System
│
Docker Engine
│
Containers
Containers include only the application and the dependencies required to run it.
| Virtual Machines | Docker Containers |
|---|---|
| Includes a complete guest OS | Shares the host kernel |
| Usually heavier | Usually lighter |
| Slower startup | Faster startup |
| More resource consumption | Lower resource consumption |
| Strong OS-level isolation | Process-level isolation |
| Larger disk usage | Smaller images |
| Good for running different operating systems | Good for packaging and deploying applications |
Docker is useful for this project because each service can run in an isolated environment without requiring a complete virtual machine.
Environment variables are commonly used for configuration:
MYSQL_USER=wordpress
MYSQL_DATABASE=wordpressThey are useful for non-sensitive configuration.
However, environment variables can potentially be exposed through:
- Container inspection
- Process environments
- Logs
- Misconfigured debugging tools
Secrets are intended for sensitive information such as:
- Passwords
- API keys
- Database credentials
Examples:
db_password.txt
db_root_password.txt
credentials.txt
The application can read the secret from a file rather than storing the password directly inside the Dockerfile or source code.
| Secrets | Environment Variables |
|---|---|
| Designed for sensitive data | Mainly configuration data |
| Stored separately from application configuration | Passed directly into the process environment |
| Can be mounted as files | Available as environment variables |
| Better separation of credentials | Easier for normal configuration |
| Suitable for passwords and private data | Suitable for names, ports, domains, etc. |
For this project:
Environment Variables → domain names, database names, usernames
Secrets → passwords and credentials
A Docker network provides communication between containers.
For example:
NGINX ──────► WordPress ──────► MariaDB
Containers can communicate internally using their service names.
Advantages include:
- Service isolation
- Internal DNS
- Controlled communication
- Reduced exposure of internal services
With host networking, a container directly uses the host machine's network stack.
This means the container has less network isolation.
For example, ports used by the container can directly conflict with ports used by the host.
| Docker Network | Host Network |
|---|---|
| Network isolation | Uses host network directly |
| Built-in service discovery | No container network isolation |
| Internal services can remain private | Services are closer to host networking |
| Better separation between services | Possible port conflicts |
| Recommended for multi-container architectures | Useful for specific networking requirements |
The Inception infrastructure uses a Docker network so that WordPress and MariaDB can communicate internally without exposing unnecessary ports to the host.
Docker volumes are managed by Docker.
They are designed for persistent container data.
Example:
MariaDB container
│
▼
Docker Volume
│
▼
Persistent database data
Advantages:
- Managed by Docker
- Independent from the container lifecycle
- Suitable for persistent application data
- Easier to move between containers
A bind mount connects a specific directory from the host machine to a container.
Example:
Host directory
│
▼
Bind Mount
│
▼
Container directory
Changes on the host are immediately visible inside the container.
Bind mounts are useful for:
- Development
- Source code synchronization
- Direct access to host files
| Docker Volumes | Bind Mounts |
|---|---|
| Managed by Docker | Managed by the host filesystem |
| Docker chooses or manages the storage location | Uses a specific host path |
| Better for persistent application data | Useful for development |
| More portable | Depends on the host directory structure |
| Easier to manage with Docker commands | Direct host access |
For this project, persistent application data is stored using Docker volumes or Docker-managed persistent storage, depending on the project's required configuration.
After starting the infrastructure, open the configured domain in your browser:
https://shrimech.42.fr
NGINX receives the HTTPS request and forwards it to WordPress.
The request flow is:
Browser
│
│ HTTPS :443
▼
NGINX
│
│ FastCGI
▼
WordPress / PHP-FPM
│
│ SQL
▼
MariaDB
Check running containers:
docker psCheck all containers:
docker ps -aCheck Docker images:
docker imagesCheck Docker volumes:
docker volume lsCheck Docker networks:
docker network lsView container logs:
docker logs <container_name>Open a shell inside a running container:
docker exec -it <container_name> bashIf Bash is not available:
docker exec -it <container_name> sh- Docker Documentation
- Docker Engine Documentation
- Docker Compose Documentation
- Docker Networking Documentation
- Docker Volumes Documentation
- Docker Storage Documentation
- Dockerfile Reference
Useful starting points:
- Docker: https://docs.docker.com/
- Docker Compose: https://docs.docker.com/compose/
- Docker Networking: https://docs.docker.com/network/
- Docker Volumes: https://docs.docker.com/engine/storage/volumes/
- Dockerfile Reference: https://docs.docker.com/reference/dockerfile/
-
NGINX Documentation
-
NGINX Beginner's Guide
-
NGINX SSL/TLS Configuration
-
NGINX: https://nginx.org/en/docs/
-
WordPress Documentation
-
WordPress Command Line Interface documentation
-
WordPress configuration documentation
-
WordPress Developer Resources: https://developer.wordpress.org/
-
MariaDB Documentation
-
MariaDB Server Documentation
- 42 Network — Inception project documentation and subject
- Docker Deep Dive by Nigel Poulton
- Official Docker tutorials
- Linux namespaces and cgroups documentation
Artificial intelligence tools were used as a learning and development assistant during this project.
AI was used for:
- Explaining Docker concepts and architecture
- Understanding the differences between Docker, containers, container runtimes, and virtual machines
- Learning about Docker networking and volumes
- Understanding Dockerfiles and Docker Compose configuration
- Debugging configuration and container-related errors
- Explaining NGINX, PHP-FPM, WordPress, and MariaDB interactions
- Reviewing shell scripts and configuration files
- Improving documentation and the structure of this README
AI-generated suggestions were reviewed, understood, tested, and adapted before being integrated into the project.
AI was not used as a replacement for understanding the project requirements. The final implementation, configuration choices, testing, and validation remain the responsibility of the project author.
Through this project, the following concepts are explored:
- Docker
- Containerization
- Dockerfiles
- Docker Compose
- Linux processes
- Networking
- TLS/HTTPS
- Reverse proxies
- PHP-FPM
- Database services
- Persistent storage
- Docker volumes
- Environment variables
- Secrets management
- Service orchestration
- Infrastructure design
This project was developed as part of the 42 curriculum and is intended for educational purposes.