WooCommerce E-commerce Stack
WordPress WooCommerce with MySQL and Redis.
Overview
WordPress powers over 40% of websites globally, serving as the world's most popular content management system with an ecosystem of 60,000+ plugins and thousands of themes. WooCommerce extends WordPress into a full-featured e-commerce platform, handling everything from product catalogs and inventory management to payment processing and order fulfillment. This stack combines WordPress and WooCommerce with MySQL for reliable data storage, Redis for high-performance caching and session management, and Nginx as a reverse proxy to handle HTTP requests efficiently. MySQL provides ACID-compliant transactions essential for e-commerce operations, while Redis delivers sub-millisecond response times for cart data and user sessions. Nginx's event-driven architecture serves static assets like product images while proxying dynamic requests to WordPress, creating a robust foundation for online stores. This combination is ideal for e-commerce businesses seeking a proven, scalable platform with extensive customization options. Startups can leverage WooCommerce's free core with premium extensions as they grow, while established retailers benefit from the vast ecosystem of themes, payment gateways, and marketing tools. The stack supports everything from digital downloads to complex physical product catalogs with variations, making it suitable for businesses ranging from artisan shops to enterprise retailers processing thousands of orders daily.
Key Features
- WooCommerce plugin ecosystem with 400+ official extensions for payments, shipping, and marketing
- WordPress Gutenberg block editor with WooCommerce product blocks for visual store building
- MySQL InnoDB storage engine with ACID compliance for transaction integrity
- Redis object caching for WordPress database queries and WooCommerce cart persistence
- Nginx FastCGI caching with WordPress-specific rules for dynamic content optimization
- WordPress REST API and WooCommerce API for headless commerce implementations
- MySQL full-text search capabilities for product catalog indexing
- Redis session storage for improved checkout performance and user experience
Common Use Cases
- 1Small to medium online retailers selling physical products with inventory management
- 2Digital product marketplaces offering downloads, courses, or subscription services
- 3Multi-vendor marketplaces using WooCommerce marketplace extensions
- 4B2B wholesale stores with tiered pricing and customer-specific catalogs
- 5Dropshipping businesses integrating with suppliers and fulfillment services
- 6Subscription-based businesses selling recurring products or memberships
- 7Local businesses expanding online with pickup/delivery options and local payment methods
Prerequisites
- Minimum 2GB RAM (MySQL 1GB, WordPress 512MB, Redis 256MB, Nginx 256MB)
- Available ports 80 and 443 for HTTP/HTTPS traffic
- Understanding of WordPress administration and plugin management
- Basic knowledge of WooCommerce store configuration and product setup
- SSL certificate for secure payment processing (Let's Encrypt recommended)
- Familiarity with payment gateway APIs (Stripe, PayPal, etc.) for transaction processing
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 wordpress: 3 image: wordpress:latest4 container_name: woocommerce5 restart: unless-stopped6 environment: 7 - WORDPRESS_DB_HOST=woo-mysql8 - WORDPRESS_DB_USER=${DB_USER}9 - WORDPRESS_DB_PASSWORD=${DB_PASSWORD}10 - WORDPRESS_DB_NAME=woocommerce11 volumes: 12 - wordpress_data:/var/www/html13 depends_on: 14 - woo-mysql15 - woo-redis1617 woo-mysql: 18 image: mysql:8.019 container_name: woo-mysql20 restart: unless-stopped21 environment: 22 - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}23 - MYSQL_DATABASE=woocommerce24 - MYSQL_USER=${DB_USER}25 - MYSQL_PASSWORD=${DB_PASSWORD}26 volumes: 27 - mysql_data:/var/lib/mysql2829 woo-redis: 30 image: redis:7-alpine31 container_name: woo-redis32 restart: unless-stopped33 volumes: 34 - redis_data:/data3536 nginx: 37 image: nginx:alpine38 container_name: woo-nginx39 restart: unless-stopped40 ports: 41 - "${NGINX_PORT:-80}:80"42 - "${NGINX_SSL_PORT:-443}:443"43 volumes: 44 - ./nginx.conf:/etc/nginx/nginx.conf:ro45 - wordpress_data:/var/www/html:ro46 depends_on: 47 - wordpress4849volumes: 50 wordpress_data: 51 mysql_data: 52 redis_data: .env Template
.env
1# WooCommerce2NGINX_PORT=803NGINX_SSL_PORT=4434DB_USER=woocommerce5DB_PASSWORD=woo_password6DB_ROOT_PASSWORD=root_passwordUsage Notes
- 1Docs: https://woocommerce.com/documentation/
- 2WooCommerce at http://localhost through Nginx reverse proxy
- 3Complete WordPress setup wizard, then install WooCommerce plugin
- 4Redis Object Cache plugin for performance (connect to woo-redis:6379)
- 5Configure payment gateways: Stripe, PayPal, bank transfer
- 6SSL recommended - use Let's Encrypt with certbot
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
wordpress
wordpress:
image: wordpress:latest
container_name: woocommerce
restart: unless-stopped
environment:
- WORDPRESS_DB_HOST=woo-mysql
- WORDPRESS_DB_USER=${DB_USER}
- WORDPRESS_DB_PASSWORD=${DB_PASSWORD}
- WORDPRESS_DB_NAME=woocommerce
volumes:
- wordpress_data:/var/www/html
depends_on:
- woo-mysql
- woo-redis
woo-mysql
woo-mysql:
image: mysql:8.0
container_name: woo-mysql
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MYSQL_DATABASE=woocommerce
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
woo-redis
woo-redis:
image: redis:7-alpine
container_name: woo-redis
restart: unless-stopped
volumes:
- redis_data:/data
nginx
nginx:
image: nginx:alpine
container_name: woo-nginx
restart: unless-stopped
ports:
- ${NGINX_PORT:-80}:80
- ${NGINX_SSL_PORT:-443}:443
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- wordpress_data:/var/www/html:ro
depends_on:
- wordpress
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 wordpress:5 image: wordpress:latest6 container_name: woocommerce7 restart: unless-stopped8 environment:9 - WORDPRESS_DB_HOST=woo-mysql10 - WORDPRESS_DB_USER=${DB_USER}11 - WORDPRESS_DB_PASSWORD=${DB_PASSWORD}12 - WORDPRESS_DB_NAME=woocommerce13 volumes:14 - wordpress_data:/var/www/html15 depends_on:16 - woo-mysql17 - woo-redis1819 woo-mysql:20 image: mysql:8.021 container_name: woo-mysql22 restart: unless-stopped23 environment:24 - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}25 - MYSQL_DATABASE=woocommerce26 - MYSQL_USER=${DB_USER}27 - MYSQL_PASSWORD=${DB_PASSWORD}28 volumes:29 - mysql_data:/var/lib/mysql3031 woo-redis:32 image: redis:7-alpine33 container_name: woo-redis34 restart: unless-stopped35 volumes:36 - redis_data:/data3738 nginx:39 image: nginx:alpine40 container_name: woo-nginx41 restart: unless-stopped42 ports:43 - "${NGINX_PORT:-80}:80"44 - "${NGINX_SSL_PORT:-443}:443"45 volumes:46 - ./nginx.conf:/etc/nginx/nginx.conf:ro47 - wordpress_data:/var/www/html:ro48 depends_on:49 - wordpress5051volumes:52 wordpress_data:53 mysql_data:54 redis_data:55EOF5657# 2. Create the .env file58cat > .env << 'EOF'59# WooCommerce60NGINX_PORT=8061NGINX_SSL_PORT=44362DB_USER=woocommerce63DB_PASSWORD=woo_password64DB_ROOT_PASSWORD=root_password65EOF6667# 3. Start the services68docker compose up -d6970# 4. View logs71docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/woocommerce-stack/run | bashTroubleshooting
- WordPress database connection error: Verify WORDPRESS_DB_HOST points to 'woo-mysql' and database credentials match MYSQL_USER/MYSQL_PASSWORD
- WooCommerce checkout timeouts: Install Redis Object Cache plugin and configure it to connect to 'woo-redis:6379' for session persistence
- MySQL max_connections exceeded: Add 'max_connections=200' to MySQL environment variables or custom configuration file
- Nginx 502 Bad Gateway errors: Check that WordPress container is healthy and PHP-FPM is responding on port 9000
- WooCommerce product images not loading: Ensure wordpress_data volume is mounted to both WordPress and Nginx containers with proper permissions
- Redis memory usage warnings: Configure Redis maxmemory policy with 'maxmemory-policy allkeys-lru' for cache eviction
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
Components
wordpressmysqlredisnginx
Tags
#woocommerce#wordpress#ecommerce#shop
Category
E-Commerce & BusinessAd Space
Shortcuts: C CopyF FavoriteD Download