docker.recipes

Sylius

advanced

Symfony-based e-commerce framework.

Overview

Sylius is a modern, component-based e-commerce framework built on Symfony, designed for developers who need a flexible alternative to monolithic platforms like Magento or WooCommerce. Created in 2011 by Paweł Jędrzejewski, Sylius follows Symfony's philosophy of reusable components and clean architecture, allowing developers to build custom e-commerce solutions without being locked into rigid structures. Unlike traditional e-commerce platforms, Sylius provides a headless-first approach with API Platform integration, making it ideal for omnichannel retail strategies. This stack combines Sylius with MySQL 8.0 and Redis to create a production-ready e-commerce environment. MySQL serves as the primary data store for product catalogs, orders, customers, and inventory management, while Redis handles session storage, caching layer for product queries, and real-time features like cart persistence. The combination leverages MySQL's ACID compliance for transactional integrity during checkout processes and Redis's sub-millisecond response times for shopping cart operations and product recommendation caching. This configuration targets mid-to-large scale e-commerce operations, digital agencies building custom storefronts, and businesses requiring headless commerce capabilities. The Symfony foundation makes it particularly attractive to PHP development teams already familiar with modern PHP practices, while the API-first architecture supports mobile apps, progressive web apps, and third-party integrations that traditional e-commerce platforms struggle to handle efficiently.

Key Features

  • API Platform powered REST and GraphQL APIs for headless commerce implementations
  • Component-based architecture allowing selective feature implementation without bloat
  • Advanced promotion engine with rule-based discounts, coupons, and cart promotions
  • Multi-channel support for managing different storefronts from single admin panel
  • Flexible product variant system supporting configurable products with attributes
  • Built-in inventory tracking with stock management and reservation system
  • Taxation system with zone-based tax calculations and configurable tax categories
  • Payment abstraction layer supporting multiple payment gateways through Payum integration

Common Use Cases

  • 1Digital agencies building custom e-commerce solutions for clients requiring unique designs
  • 2B2B marketplaces needing complex pricing tiers, customer groups, and bulk ordering features
  • 3Fashion retailers managing product variants with size, color, and seasonal collections
  • 4Multi-brand retailers operating separate storefronts with shared inventory management
  • 5Businesses implementing headless commerce with React, Vue, or mobile app frontends
  • 6Companies requiring extensive API integrations with ERP, CRM, or PIM systems
  • 7Subscription commerce platforms needing custom billing cycles and recurring payment handling

Prerequisites

  • Docker Engine 20.10+ and Docker Compose V2 for container orchestration
  • 4GB+ RAM recommended for MySQL InnoDB buffer pool and Redis memory allocation
  • PHP 8.1+ knowledge for Sylius customization and Symfony framework concepts
  • Port 8080 available for Sylius web interface and port 3306 free for MySQL connections
  • Basic understanding of Twig templating engine for storefront customization
  • Familiarity with Doctrine ORM for entity management and database operations

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 sylius:
3 image: sylius/sylius:latest
4 container_name: sylius
5 restart: unless-stopped
6 environment:
7 APP_ENV: prod
8 DATABASE_URL: mysql://${DB_USER}:${DB_PASSWORD}@mysql:3306/${DB_NAME}
9 volumes:
10 - sylius_data:/srv/sylius/public
11 ports:
12 - "8080:80"
13 depends_on:
14 - mysql
15 - redis
16 networks:
17 - sylius
18
19 mysql:
20 image: mysql:8.0
21 container_name: sylius-mysql
22 environment:
23 MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
24 MYSQL_DATABASE: ${DB_NAME}
25 MYSQL_USER: ${DB_USER}
26 MYSQL_PASSWORD: ${DB_PASSWORD}
27 volumes:
28 - mysql_data:/var/lib/mysql
29 networks:
30 - sylius
31
32 redis:
33 image: redis:alpine
34 container_name: sylius-redis
35 networks:
36 - sylius
37
38volumes:
39 sylius_data:
40 mysql_data:
41
42networks:
43 sylius:
44 driver: bridge

.env Template

.env
1DB_ROOT_PASSWORD=rootpassword
2DB_NAME=sylius
3DB_USER=sylius
4DB_PASSWORD=changeme

Usage Notes

  1. 1Docs: https://docs.sylius.com/
  2. 2Access at http://localhost:8080 - built on Symfony PHP framework
  3. 3Admin at /admin, default: sylius@example.com / sylius
  4. 4Component-based architecture - use only what you need
  5. 5API Platform powered REST API for headless commerce
  6. 6Plugins marketplace for payments, shipping, promotions

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

sylius
sylius:
  image: sylius/sylius:latest
  container_name: sylius
  restart: unless-stopped
  environment:
    APP_ENV: prod
    DATABASE_URL: mysql://${DB_USER}:${DB_PASSWORD}@mysql:3306/${DB_NAME}
  volumes:
    - sylius_data:/srv/sylius/public
  ports:
    - "8080:80"
  depends_on:
    - mysql
    - redis
  networks:
    - sylius
mysql
mysql:
  image: mysql:8.0
  container_name: sylius-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:
    - sylius
redis
redis:
  image: redis:alpine
  container_name: sylius-redis
  networks:
    - sylius

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 sylius:
5 image: sylius/sylius:latest
6 container_name: sylius
7 restart: unless-stopped
8 environment:
9 APP_ENV: prod
10 DATABASE_URL: mysql://${DB_USER}:${DB_PASSWORD}@mysql:3306/${DB_NAME}
11 volumes:
12 - sylius_data:/srv/sylius/public
13 ports:
14 - "8080:80"
15 depends_on:
16 - mysql
17 - redis
18 networks:
19 - sylius
20
21 mysql:
22 image: mysql:8.0
23 container_name: sylius-mysql
24 environment:
25 MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
26 MYSQL_DATABASE: ${DB_NAME}
27 MYSQL_USER: ${DB_USER}
28 MYSQL_PASSWORD: ${DB_PASSWORD}
29 volumes:
30 - mysql_data:/var/lib/mysql
31 networks:
32 - sylius
33
34 redis:
35 image: redis:alpine
36 container_name: sylius-redis
37 networks:
38 - sylius
39
40volumes:
41 sylius_data:
42 mysql_data:
43
44networks:
45 sylius:
46 driver: bridge
47EOF
48
49# 2. Create the .env file
50cat > .env << 'EOF'
51DB_ROOT_PASSWORD=rootpassword
52DB_NAME=sylius
53DB_USER=sylius
54DB_PASSWORD=changeme
55EOF
56
57# 3. Start the services
58docker compose up -d
59
60# 4. View logs
61docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/sylius/run | bash

Troubleshooting

  • Sylius returns 500 error on startup: Check DATABASE_URL environment variable format and ensure MySQL container is fully initialized before Sylius starts
  • Admin panel shows 'Access Denied' with correct credentials: Clear Redis cache using 'docker exec sylius-redis redis-cli FLUSHALL' and restart Sylius container
  • Product images not displaying: Verify sylius_data volume is properly mounted and web server has write permissions to public/media directory
  • MySQL connection refused errors: Wait 30-60 seconds after 'docker-compose up' as MySQL 8.0 initialization takes time, especially on first run
  • Cart contents disappearing between sessions: Ensure Redis container is running and Sylius session configuration points to Redis server
  • Composer memory exhausted during asset installation: Add COMPOSER_MEMORY_LIMIT=-1 environment variable to Sylius service definition

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space