How markshust/docker-magento works
Project type and purpose
• This is an infrastructure-as-code repository providing Docker-based development environment for Magento 2.
• It delivers Docker images (nginx, php-fpm, opensearch/elasticsearch, rabbitmq, ssh) under images/ and sample Docker Compose setups under compose/.
• It wraps common Magento operations via shell scripts in compose/bin/ (e.g., bin/start, bin/mysql, bin/magento, bin/update).
Main components of the system
• Host environment – developer’s machine running Docker Desktop or Docker on Linux/WSL.
• Docker daemon / Docker Compose orchestration.
• Containers:
• nginx – serves HTTP(S) requests, reverse-proxies to PHP-FPM.
• php-fpm – runs PHP code (Magento), mounts project source (src).
• db – MySQL/MariaDB for Magento data storage.
• redis – cache and session storage.
• elasticsearch OR opensearch – search engine.
• rabbitmq – message queue.
• ssh – optional SFTP/SSH server for IDE sync.
• mailcatcher (in compose.dev.yaml) – intercepts outbound email.
• phpmyadmin (in compose.dev.yaml) – web UI for MySQL.
• selenium (optional for MFTF tests).
• Volumes:
• Source code volume (src).
• Data volumes: db data, redis data, rabbitmq data, search engine data.
• Configuration bind-mounts: Docker Compose YAML, env files, Nginx/PHP configs.
• Networks:
• Single bridge network where service hostnames equal service names (e.g., db, redis, elasticsearch).
Relationships and interactions
• User browser ↔ nginx container (80/443)
nginx ↔ php-fpm via FastCGI socket/port.
• php-fpm ↔ db over TCP (db:3306).
• php-fpm ↔ redis (redis:6379) for cache, sessions, page‐cache.
• php-fpm ↔ search engine (opensearch:9200 or elasticsearch:9200).
• php-fpm ↔ rabbitmq (rabbitmq:5672) for async jobs.
• php-fpm ↔ mailcatcher (mailcatcher:1025) for SMTP and mail UI (:1080).
• php-fpm ↔ phpmyadmin (optional) only host↔phpmyadmin↔db.
• IDE/host ↔ ssh container for file sync (compose.dev-ssh.yaml).
• CI/CD pipelines (GitHub Actions) build/publish custom Docker images from images/.
Architectural patterns and design principles
• Container per service; each service isolated; everything defined in Docker Compose.
• Volumes provide data persistence; bind-mount for source code.
• Environment files (compose/env/*.env) decouple configuration.
• CLI‐wrapper pattern: wrapper scripts (compose/bin/*) abstract Docker Compose commands.
• Healthcheck compose file to verify operational status of services before start.
Relevant technologies, frameworks, and libraries
• Docker, Docker Compose (multiple YAML templates).
• Magento 2 (PHP application).
• PHP-FPM, Nginx.
• MySQL (or MariaDB).
• Redis.
• Elasticsearch / OpenSearch.
• RabbitMQ.
• Mailcatcher, PhpMyAdmin, Selenium (optional).
• Blackfire.io, Cloudflare Tunnel, SPX profiling (via PHP extensions).
• Grunt and LiveReload for frontend.
Detail
• Service, its ports, its dependencies.
• Distinguish dev-only services (phpmyadmin, selenium) vs core environment.
• Version build pipelines (GitHub Actions) for image creation if relevant to ops.