docker.recipes

OpenCart Store

beginner

OpenCart ecommerce platform with MySQL.

Overview

OpenCart is a free, open-source PHP-based e-commerce platform that has powered over 350,000 online stores since 2009. Built with simplicity in mind, OpenCart offers a complete shopping cart solution with multi-store management, extensive theme customization, and over 13,000 modules and themes available through its marketplace. The platform supports multiple languages, currencies, and payment gateways, making it ideal for businesses looking to establish an international online presence without the complexity of enterprise-level platforms. This stack combines OpenCart with MySQL 8.0 to create a robust e-commerce environment where MySQL's InnoDB storage engine handles transactional integrity for orders, inventory, and customer data. MySQL's query cache optimizes performance for product catalogs and search functionality, while OpenCart's PHP architecture leverages MySQL's full-text search capabilities for product filtering and customer searches. The Bitnami OpenCart image includes pre-configured PHP extensions and optimization settings that work efficiently with MySQL's connection pooling and prepared statements. This configuration serves online retailers, dropshipping businesses, and entrepreneurs who need a complete e-commerce solution with reliable data persistence and scalability. The combination is particularly valuable for businesses expecting moderate to high transaction volumes, as MySQL's ACID compliance ensures order integrity while OpenCart's multi-store capabilities allow management of multiple brands or regional stores from a single installation.

Key Features

  • OpenCart's multi-store architecture allowing unlimited stores from single admin panel with shared customer database
  • MySQL InnoDB storage engine with ACID compliance for transactional integrity of orders and payments
  • OpenCart marketplace integration with 13,000+ extensions and themes accessible from admin interface
  • MySQL full-text indexing optimized for OpenCart's product search and category filtering
  • OpenCart's built-in SEO URL system with MySQL database-driven URL rewriting
  • Bitnami OpenCart image with pre-configured PHP-FPM and MySQL connection optimization
  • OpenCart's multi-currency and multi-language support with MySQL UTF-8 character set handling
  • MySQL Group Replication compatibility for high-availability e-commerce deployments

Common Use Cases

  • 1Small to medium online retailers launching product catalogs with integrated payment processing
  • 2Dropshipping businesses managing supplier catalogs and automated order fulfillment workflows
  • 3Multi-brand retailers operating separate storefronts with consolidated inventory management
  • 4International e-commerce sites requiring multi-currency pricing and localized product descriptions
  • 5Digital agencies developing custom e-commerce solutions for clients with OpenCart extensions
  • 6B2B wholesale platforms with customer-specific pricing and restricted product access
  • 7Marketplace operators hosting multiple vendor stores with centralized order processing

Prerequisites

  • Minimum 2GB RAM recommended for OpenCart with moderate product catalogs and concurrent users
  • Ports 80 and 443 available for HTTP/HTTPS traffic to OpenCart storefront and admin panel
  • Basic understanding of OpenCart admin interface for store configuration and product management
  • Familiarity with MySQL backup procedures for protecting customer and order data
  • Knowledge of PHP configuration for OpenCart performance tuning and extension installation
  • SSL certificate management experience for securing customer checkout and payment processes

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 mysql:
3 image: mysql:8.0
4 container_name: opencart-mysql
5 restart: unless-stopped
6 environment:
7 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
8 MYSQL_DATABASE: ${MYSQL_DATABASE:-opencart}
9 MYSQL_USER: ${MYSQL_USER:-opencart}
10 MYSQL_PASSWORD: ${MYSQL_PASSWORD:-opencart}
11 volumes:
12 - mysql_data:/var/lib/mysql
13 networks:
14 - opencart-network
15
16 opencart:
17 image: bitnami/opencart:latest
18 container_name: opencart
19 restart: unless-stopped
20 ports:
21 - "${OPENCART_PORT:-80}:8080"
22 - "${OPENCART_HTTPS_PORT:-443}:8443"
23 environment:
24 - OPENCART_HOST=localhost
25 - OPENCART_DATABASE_HOST=mysql
26 - OPENCART_DATABASE_NAME=${MYSQL_DATABASE:-opencart}
27 - OPENCART_DATABASE_USER=${MYSQL_USER:-opencart}
28 - OPENCART_DATABASE_PASSWORD=${MYSQL_PASSWORD:-opencart}
29 - OPENCART_USERNAME=${OPENCART_USER:-admin}
30 - OPENCART_PASSWORD=${OPENCART_PASSWORD:-admin123}
31 - OPENCART_EMAIL=${OPENCART_EMAIL:-admin@example.com}
32 volumes:
33 - opencart_data:/bitnami/opencart
34 depends_on:
35 - mysql
36 networks:
37 - opencart-network
38
39volumes:
40 mysql_data:
41 opencart_data:
42
43networks:
44 opencart-network:
45 driver: bridge

.env Template

.env
1# OpenCart
2OPENCART_PORT=80
3OPENCART_HTTPS_PORT=443
4MYSQL_ROOT_PASSWORD=root
5MYSQL_DATABASE=opencart
6MYSQL_USER=opencart
7MYSQL_PASSWORD=opencart
8OPENCART_USER=admin
9OPENCART_PASSWORD=admin123
10OPENCART_EMAIL=admin@example.com

Usage Notes

  1. 1Docs: https://docs.opencart.com/
  2. 2Storefront at http://localhost, admin at /admin
  3. 3Login: use OPENCART_USER/OPENCART_PASSWORD from env
  4. 4Extension marketplace: Extensions > Marketplace in admin
  5. 5SEO URLs: enable in System > Settings > Server tab
  6. 6Multi-store support built-in - configure in System > Settings

Individual Services(2 services)

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

mysql
mysql:
  image: mysql:8.0
  container_name: opencart-mysql
  restart: unless-stopped
  environment:
    MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
    MYSQL_DATABASE: ${MYSQL_DATABASE:-opencart}
    MYSQL_USER: ${MYSQL_USER:-opencart}
    MYSQL_PASSWORD: ${MYSQL_PASSWORD:-opencart}
  volumes:
    - mysql_data:/var/lib/mysql
  networks:
    - opencart-network
opencart
opencart:
  image: bitnami/opencart:latest
  container_name: opencart
  restart: unless-stopped
  ports:
    - ${OPENCART_PORT:-80}:8080
    - ${OPENCART_HTTPS_PORT:-443}:8443
  environment:
    - OPENCART_HOST=localhost
    - OPENCART_DATABASE_HOST=mysql
    - OPENCART_DATABASE_NAME=${MYSQL_DATABASE:-opencart}
    - OPENCART_DATABASE_USER=${MYSQL_USER:-opencart}
    - OPENCART_DATABASE_PASSWORD=${MYSQL_PASSWORD:-opencart}
    - OPENCART_USERNAME=${OPENCART_USER:-admin}
    - OPENCART_PASSWORD=${OPENCART_PASSWORD:-admin123}
    - OPENCART_EMAIL=${OPENCART_EMAIL:-admin@example.com}
  volumes:
    - opencart_data:/bitnami/opencart
  depends_on:
    - mysql
  networks:
    - opencart-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 mysql:
5 image: mysql:8.0
6 container_name: opencart-mysql
7 restart: unless-stopped
8 environment:
9 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
10 MYSQL_DATABASE: ${MYSQL_DATABASE:-opencart}
11 MYSQL_USER: ${MYSQL_USER:-opencart}
12 MYSQL_PASSWORD: ${MYSQL_PASSWORD:-opencart}
13 volumes:
14 - mysql_data:/var/lib/mysql
15 networks:
16 - opencart-network
17
18 opencart:
19 image: bitnami/opencart:latest
20 container_name: opencart
21 restart: unless-stopped
22 ports:
23 - "${OPENCART_PORT:-80}:8080"
24 - "${OPENCART_HTTPS_PORT:-443}:8443"
25 environment:
26 - OPENCART_HOST=localhost
27 - OPENCART_DATABASE_HOST=mysql
28 - OPENCART_DATABASE_NAME=${MYSQL_DATABASE:-opencart}
29 - OPENCART_DATABASE_USER=${MYSQL_USER:-opencart}
30 - OPENCART_DATABASE_PASSWORD=${MYSQL_PASSWORD:-opencart}
31 - OPENCART_USERNAME=${OPENCART_USER:-admin}
32 - OPENCART_PASSWORD=${OPENCART_PASSWORD:-admin123}
33 - OPENCART_EMAIL=${OPENCART_EMAIL:-admin@example.com}
34 volumes:
35 - opencart_data:/bitnami/opencart
36 depends_on:
37 - mysql
38 networks:
39 - opencart-network
40
41volumes:
42 mysql_data:
43 opencart_data:
44
45networks:
46 opencart-network:
47 driver: bridge
48EOF
49
50# 2. Create the .env file
51cat > .env << 'EOF'
52# OpenCart
53OPENCART_PORT=80
54OPENCART_HTTPS_PORT=443
55MYSQL_ROOT_PASSWORD=root
56MYSQL_DATABASE=opencart
57MYSQL_USER=opencart
58MYSQL_PASSWORD=opencart
59OPENCART_USER=admin
60OPENCART_PASSWORD=admin123
61OPENCART_EMAIL=admin@example.com
62EOF
63
64# 3. Start the services
65docker compose up -d
66
67# 4. View logs
68docker 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/opencart-store/run | bash

Troubleshooting

  • OpenCart installation wizard fails to connect: Verify OPENCART_DATABASE_HOST points to 'mysql' service name and database credentials match
  • Product images not displaying after restart: Check opencart_data volume mount and ensure /bitnami/opencart/image directory permissions are correct
  • MySQL connection limit errors during high traffic: Increase MySQL max_connections parameter and configure OpenCart database connection pooling
  • OpenCart admin login redirects to setup: Delete install directory from opencart_data volume or set OPENCART_SKIP_INSTALL=yes environment variable
  • Payment gateway SSL errors: Configure OPENCART_HOST with actual domain name instead of localhost for production deployments
  • OpenCart marketplace extensions fail to install: Ensure container has write permissions to /bitnami/opencart and sufficient disk space in volume

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