# Magento Open Source

> Feature-rich e-commerce platform by Adobe.

- Category: E-Commerce & Business
- Difficulty: advanced
- Components: magento, mysql, elasticsearch, redis
- Tags: magento, ecommerce, adobe, enterprise
- Source: https://docker.recipes/ecommerce/magento

## Overview

Magento Open Source is Adobe's flagship e-commerce platform that powers thousands of online stores worldwide. Originally developed by Varien in 2008 and later acquired by Adobe, Magento provides a comprehensive solution for building scalable online retail experiences with advanced catalog management, flexible pricing rules, and extensive customization capabilities. The platform is renowned for its modular architecture, multi-store management, and robust API ecosystem that enables complex B2B and B2C commerce scenarios.

This deployment orchestrates three essential services: the Bitnami Magento container serving the complete e-commerce application, MySQL 8.0 providing transactional data storage for products, orders, and customer information, and Elasticsearch 7.17 powering the advanced catalog search and filtering capabilities. The Bitnami image includes an optimized Magento installation with Apache, PHP, and all necessary dependencies pre-configured, while Elasticsearch integration enables layered navigation, advanced search suggestions, and performance-optimized product discovery.

This stack is ideal for developers and businesses seeking a production-grade e-commerce solution without the complexity of manual Magento installation and configuration. The combination provides enterprise-level search capabilities through Elasticsearch integration, reliable data persistence with MySQL, and the flexibility to customize every aspect of the shopping experience through Magento's extensive theming and module system.

## Features

- Complete Magento Open Source installation with Bitnami optimization and security hardening
- Advanced catalog search powered by Elasticsearch with layered navigation and faceted filtering
- MySQL 8.0 with InnoDB storage engine for ACID-compliant transaction processing
- Multi-store and multi-website management from single Magento instance
- Extensive product catalog management with configurable and grouped product types
- Built-in payment gateway integrations and flexible shipping rule configuration
- Advanced customer segmentation and promotional rule engine
- REST and GraphQL APIs for headless commerce implementations

## Use cases

- Mid-market retailers launching comprehensive online stores with advanced product catalogs
- B2B wholesalers requiring complex pricing tiers and customer group management
- Multi-brand businesses managing several storefronts from unified backend
- Fashion and electronics retailers needing sophisticated product configurators
- Marketplace operators building vendor management and commission systems
- International merchants requiring multi-currency and multi-language support
- Developers prototyping custom e-commerce extensions and payment integrations

## Prerequisites

- Minimum 4GB RAM and 2 CPU cores for acceptable Magento performance
- At least 10GB available disk space for Magento files, media, and database growth
- Basic understanding of e-commerce concepts and Magento admin interface
- Ports 8080 and 8443 available for HTTP and HTTPS access
- Environment variables configured for database credentials and Magento host settings
- Patience for initial container startup as Magento installation takes 5-10 minutes

## docker-compose.yml

```yaml
services:
  magento:
    image: bitnami/magento:latest
    container_name: magento
    restart: unless-stopped
    environment:
      MAGENTO_HOST: localhost
      MAGENTO_DATABASE_HOST: mysql
      MAGENTO_DATABASE_NAME: ${DB_NAME}
      MAGENTO_DATABASE_USER: ${DB_USER}
      MAGENTO_DATABASE_PASSWORD: ${DB_PASSWORD}
      ELASTICSEARCH_HOST: elasticsearch
    volumes:
      - magento_data:/bitnami/magento
    ports:
      - "8080:8080"
      - "8443:8443"
    depends_on:
      - mysql
      - elasticsearch
    networks:
      - magento

  mysql:
    image: mysql:8.0
    container_name: magento-mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - magento

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
    container_name: magento-es
    environment:
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    volumes:
      - es_data:/usr/share/elasticsearch/data
    networks:
      - magento

volumes:
  magento_data:
  mysql_data:
  es_data:

networks:
  magento:
    driver: bridge
```

## .env

```bash
DB_ROOT_PASSWORD=rootpassword
DB_NAME=magento
DB_USER=magento
DB_PASSWORD=changeme
```

## Usage notes

- Docs: https://devdocs.magento.com/
- Access at http://localhost:8080 - initial setup takes 5-10 minutes
- Resource intensive: needs 4GB+ RAM, 2 CPU cores minimum
- Admin URL and credentials shown in container logs after setup
- Elasticsearch required for catalog search functionality
- Bitnami provides default admin: user@example.com / bitnami1

## Troubleshooting

- Magento container shows 'Installation in progress' for extended time: Check container logs with 'docker logs magento' and ensure sufficient RAM allocation
- Elasticsearch connection errors in Magento admin: Verify elasticsearch container is running and increase ES_JAVA_OPTS memory if needed
- MySQL connection refused errors: Confirm database environment variables match between magento and mysql services
- Catalog search not working after product import: Reindex Elasticsearch from Magento admin System > Index Management
- Admin login credentials unknown after setup: Check magento container logs for auto-generated admin URL and password
- Performance issues during category browsing: Increase Elasticsearch memory allocation beyond default 512MB for large catalogs

