This project has been created as part of the 42 curriculum by fmorenil.
Inception is a system administration project designed to deepen knowledge of Docker and virtualization. The goal is to configure a small infrastructure with multiple services under specific rules using Docker Compose. The infrastructure includes:
- NGINX: Web server with TLSv1.2/TLSv1.3 (port 443).
- WordPress + PHP-FPM: Content management system.
- MariaDB: Database management system.
Each service runs in its own Docker container with custom images built from Dockerfiles. Data persists using Docker volumes, and services communicate through a dedicated Docker network.
- Docker and Docker Compose installed.
- Root or sudo access to create directories on the host system.
- A
.envfile insrcs/with the required credentials.
- Create the
.envfile insrcs/with the following variables:
MYSQL_ROOT_PASSWORD=your_root_password
MYSQL_DATABASE=wordpress
MYSQL_USER=your_user
MYSQL_PASSWORD=your_password
WORDPRESS_DB_HOST=mariadb
WORDPRESS_DB_NAME=wordpress
WORDPRESS_DB_USER=your_user
WORDPRESS_DB_PASSWORD=your_password
WORDPRESS_TITLE=My Site
WORDPRESS_ADMIN_USER=admin
WORDPRESS_ADMIN_PASSWORD=admin_password
WORDPRESS_ADMIN_EMAIL=admin@example.com
WORDPRESS_USER=user
WORDPRESS_USER_EMAIL=user@example.com
WORDPRESS_USER_PASSWORD=user_password
DOMAIN_NAME=fmorenil.42.fr- Set up the local domain by adding this line to
/etc/hosts:
127.0.0.1 fmorenil.42.fr- Build and run the project:
makemakeormake all: Build and start all containers.make down: Stop and remove containers.make start: Start stopped containers.make stop: Stop running containers.make logs: Show real-time logs.make clean: Remove containers, networks, and images.make fclean: Full cleanup, including data volumes.make re: Rebuild everything from scratch.
- WordPress: https://fmorenil.42.fr
- Admin Panel: https://fmorenil.42.fr/wp-admin
- Docker Documentation
- Docker Compose Documentation
- WordPress Documentation
- MariaDB Documentation
- NGINX Documentation
- PHP-FPM Documentation
AI tools (GitHub Copilot, ChatGPT) were used for:
- Researching Docker best practices.
- Debugging Bash scripts and Dockerfiles.
- Optimizing NGINX and PHP-FPM configurations.
- Generating WP-CLI and MariaDB commands.
All generated code was reviewed and adapted to the project’s needs.
- Service isolation: Each service runs in its own container (MariaDB, WordPress, NGINX).
- Custom images: Built from Debian Bookworm.
- Orchestration: Managed with Docker Compose.
- Persistence: Data stored in Docker volumes.
- Auto-restart: Containers restart on failure.
- Base Image: Debian Bookworm for stability.
- Service Separation: Each service in its own container for isolation.
- Initialization Scripts: Automates setup for WordPress and MariaDB.
- Self-Signed SSL Certificates: Automatically generated for local development.
| Aspect | Virtual Machines | Docker |
|---|---|---|
| Isolation | Full OS isolation | Process-level |
| Size | GBs (full OS) | MBs (app + deps) |
| Startup Time | Minutes | Seconds |
| Resource Usage | High | Low |
| Portability | Limited | High |
| Usage in Project | ❌ | ✅ |
| Aspect | Secrets | Environment Variables |
|---|---|---|
| Security | Encrypted at rest | Visible in logs |
| Access | Mounted files | Directly accessible |
| Rotation | Easier | Manual |
| Management | Docker Swarm | Simple |
| Usage in Project | ❌ | ✅ |
| Aspect | Docker Network | Host Network |
|---|---|---|
| Isolation | ✅ Private network | ❌ Shared with host |
| DNS Resolution | ✅ Service names | ❌ Requires IPs |
| Security | ✅ Port filtering | |
| Portability | ✅ Consistent | |
| Usage in Project | ✅ | ❌ |
| Aspect | Docker Volumes | Bind Mounts |
|---|---|---|
| Management | ✅ Docker-managed | |
| Portability | ✅ Host-independent | ❌ Host-dependent |
| Performance | ✅ Optimized | Variable |
| Backup | ✅ Docker commands | Manual |
| Usage in Project | ✅ | ❌ |