This project has been created as part of the 42 curriculum by opopov.
A Docker-based infrastructure project that deploys a complete WordPress website with nginx and MariaDB, all running in separate containers on a custom Docker network.
Inception is a system administration project that introduces containerization using Docker and Docker Compose. The goal is to create a small infrastructure composed of different services running in isolated containers.
The project deploys:
- nginx — Web server handling HTTPS traffic (TLSv1.2/TLSv1.3 only)
- WordPress + PHP-FPM — Content management system with FastCGI process manager
- MariaDB — Relational database storing WordPress data
All services run on Debian Bookworm and communicate over a dedicated Docker network.
- Docker and Docker Compose installed
- Root/sudo access (for creating data directories)
- Entry in
/etc/hostsmapping your domain tologin.42.fr:
-
Copy the environment template and fill in your values:
cp srcs/.env.example srcs/.env
-
Edit
srcs/.envwith your credentials:# Domain DOMAIN_NAME=login.42.fr # MariaDB Configuration MYSQL_DATABASE=wordpress MYSQL_USER=wpuser MYSQL_PASSWORD=your_secure_password MYSQL_ROOT_PASSWORD=your_secure_root_password # WordPress Admin WP_TITLE=Inception WP_ADMIN_USER=moderator WP_ADMIN_PASSWORD=your_admin_password WP_ADMIN_EMAIL=admin@login.42.fr # WordPress Second User WP_USER=guest WP_USER_PASSWORD=your_user_password WP_USER_EMAIL=editor@login.42.fr
# Build and start all containers
make
# Or use individual commands:
make build # Build and start
make up # Start (without rebuilding)
make down # Stop containers
make clean # Stop and prune Docker system
make fclean # Full cleanup (removes volumes and data)
make re # Rebuild from scratch- Website: https://login.42.fr
- WordPress Admin Panel: https://login.42.fr/wp-admin
- Docker Documentation
- Docker Compose Documentation
- nginx Documentation
- WordPress Developer Resources
- MariaDB Knowledge Base
- WP-CLI Handbook
- Debian Bookworm Release Notes
GitHub Copilot were used during development for:
- Code explanations: Understanding Docker concepts, Dockerfile syntax, and nginx configuration
- Debugging: Troubleshooting container communication and PHP-FPM configuration
- Documentation: Assisting in writing documentation
This project uses Docker to run three services (nginx, WordPress, MariaDB) in separate containers. Docker allows each service to run independently while sharing the same host system resources efficiently.
Why Docker?
- Isolation: Each service runs in its own container without interfering with others
- Lightweight: Containers share the host kernel, using less resources than virtual machines
- Portability: The same setup works on any system with Docker installed
- Easy management: Docker Compose handles all services with simple commands
┌─────────────────────────────────────────────┐
│ Docker Network │
│ (inception) │
│ │
Port 443 │ ┌─────────┐ Port 9000 ┌──────────────┐ │
WWW ◄───────────────┼───┤ nginx ├─────────────┤ WordPress │ │
HTTPS (TLS) │ │ SSL │ FastCGI │ PHP-FPM │ │
│ └─────────┘ └──────┬───────┘ │
│ │ │ │
│ │ │ Port │
│ │ Volume: │ 3306 │
│ │ /var/www/html │ │
│ │ ▼ │
│ │ ┌──────────────┐ │
│ └─────────────────┤ MariaDB │ │
│ │ Database │ │
│ └──────────────┘ │
└─────────────────────────────────────────────┘
Inception/
├── Makefile # Build automation
├── README.md # Project documentation
├── USER_DOC.md # User documentation
├── DEV_DOC.md # Developer documentation
└── srcs/
├── .env # Environment variables (secrets)
├── .env.example # Template for .env
├── docker-compose.yml
└── requirements/
├── nginx/
│ ├── Dockerfile
│ └── default # nginx configuration
├── wordpress/
│ ├── Dockerfile
│ ├── script.sh # WordPress setup script
│ └── www.conf # PHP-FPM pool configuration
└── mariadb/
├── Dockerfile
├── script.sh # Database initialization
└── 50-server.cnf # MariaDB configuration
- Base Image: Debian Bookworm (penultimate stable version)
- Foreground Mode: All services run in foreground to work properly with Docker
- Custom Network: Containers communicate through a dedicated
inceptionnetwork - TLS Only: nginx configured for HTTPS with TLSv1.2 and TLSv1.3
- Automated Setup: WP-CLI installs WordPress automatically without manual steps
Virtual Machines:
- Size: Gigabytes per VM (includes full operating system)
- Startup time: 1-2 minutes to boot
- Resources: Each VM needs dedicated RAM and CPU
- Use case: Running different operating systems
Docker:
- Size: Megabytes per container (shares host kernel)
- Startup time: Less than 10 seconds
- Resources: All containers share host resources efficiently
- Use case: Running multiple services on the same OS
Environment Variables:
- Setup: Simple
.envfile with key-value pairs - Security: Plain text (must keep
.envout of Git) - Complexity: Easy to use and understand
Docker Secrets:
- Setup: Requires Docker Swarm mode
- Security: Encrypted storage in Docker
- Complexity: More complex configuration
Docker Bridge Network:
- Container communication: By name (e.g.,
mariadb:3306,wp-php:9000) - Security: Containers isolated from host system
- Port control: Only expose specific ports
Host Network:
- Container communication: By
localhostonly - Security: Containers have direct access to host network
- Port control: All container ports exposed to host
Docker Volumes:
- Location: Docker manages the location automatically
- Backup: Requires Docker commands to access
- Control: Docker decides where to store data
Bind Mounts:
- Location: You specify the exact path (
/home/login/data/) - Backup: Direct folder access on the host
- Control: You decide exactly where data is stored