🚧 Diese Anleitung ist noch in der Bearbeitung!!!
- Vollständige Shopware 6 Docker-Umgebung
Eine produktionsreife Docker-Setup für Shopware 6 Development mit allen benötigten Services.
shopware-docker/
├── docker-compose.yml
├── docker/
│ ├── Dockerfile
│ ├── nginx/
│ │ └── default.conf
│ └── php/
│ ├── php.ini
│ └── php-fpm.conf
├── src/
│ └── (Shopware 6 Code)
└── .env
docker compose up -d
# In den App-Container
docker compose exec app bash
# Shopware per Composer installieren
# composer create-project shopware/production .
shopware-cli project create .
# Oder Clone von Git
git clone https://github.com/shopware/platform shopware6
cd shopware6
composer install
# Shopware Setup
bin/console system:install --basic-setup --create-database
shopware-cli project generate-jwt .
# bin/console plugin:refresh
# bin/console theme:refresh
bin/console assets:install
# Admin-User erstellen
bin/console user:create --admin --password johndoe123 --firstName John --lastName Doe --email john@doe.com john
# Storefront bauen
./bin/build-storefront.sh
# Oder mit Node-Container
docker compose --profile dev up node
- Storefront: http://localhost:8000
- Admin: http://localhost:8000/admin
# In den Container
docker compose exec app bash
# Plugin erstellen
bin/console plugin:create SwagExamplePlugin
# Plugin installieren
bin/console plugin:refresh
bin/console plugin:install SwagExamplePlugin --activate
# Cache leeren
bin/console cache:clear
# Theme erstellen
bin/console theme:create MyTheme
# Theme zuweisen
bin/console theme:change MyTheme
# Theme kompilieren
bin/console theme:compile
# Watch Mode mit Node
docker compose --profile dev up node
# SQL Import
docker compose exec -T mysql mysql -u shopware -pshopware shopware < backup.sql
# SQL Export
docker compose exec mysql mysqldump -u shopware -pshopware shopware > backup.sql
# Direkt in Container
docker compose exec mysql mysql -u shopware -pshopware shopware
docker/php/php.ini erweitern:
[xdebug]
zend_extension=xdebug.so
xdebug.mode=debug,develop
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.idekey=PHPSTORM
Dockerfile ergänzen:
RUN apk add --no-cache $PHPIZE_DEPS && \
pecl install xdebug && \
docker-php-ext-enable xdebug
- Einstellungen → PHP → Servers
- Name:
docker - Host:
localhost - Port:
8000 - Debugger:
Xdebug - Path Mappings:
/var/www/html→./shopware
services:
app:
environment:
APP_ENV: prod
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
nginx:
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
mysql:
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--innodb-buffer-pool-size=2G
Starten:
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#!/bin/bash
# backup.sh
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="./backups/$DATE"
mkdir -p $BACKUP_DIR
# Datenbank
docker compose exec -T mysql mysqldump -u shopware -pshopware shopware > $BACKUP_DIR/database.sql
# Files
docker compose exec app tar czf - /var/www/html/files /var/www/html/media > $BACKUP_DIR/files.tar.gz
echo "Backup erstellt: $BACKUP_DIR"
#!/bin/bash
# restore.sh
BACKUP_DIR=$1
# Datenbank
docker compose exec -T mysql mysql -u shopware -pshopware shopware < $BACKUP_DIR/database.sql
# Files
cat $BACKUP_DIR/files.tar.gz | docker compose exec -T app tar xzf - -C /
Bereits in php.ini konfiguriert.
config/packages/framework.yaml:
framework:
session:
handler_id: 'redis://redis:6379/0'
docker compose exec app bash
composer require predis/predis.env.local:
### Redis – Datenbanken ###
# 0 = HTTP Cache
REDIS_URL_HTTP_CACHE=redis://redis:6379/0
# 1 = Session Storage
REDIS_URL_SESSIONS=redis://redis:6379/1
# 2 = Increment Counter (z. B. User-Aktivität, Message Queue)
REDIS_URL_INCREMENT=redis://redis:6379/2
# 3 = Default Cache (App + System)
REDIS_URL_CACHE=redis://redis:6379/3
# 4 Message Queue
REDIS_URL_MESSENGER=redis://redis:6379/4# config/packages/cache.yaml
framework:
cache:
app: cache.adapter.redis_tag_aware
system: cache.adapter.redis_tag_aware
default_redis_provider: '%env(resolve:REDIS_URL_CACHE)%'
# Nur zusätzliche Pools dürfen hier stehen (keine cache.app oder cache.system)
pools:
cache.custom:
adapters:
- cache.adapter.redis_tag_aware
- cache.adapter.filesystem
docker compose exec app bin/console cache:clear
bin/console system:config:set core.httpCache.enabled true
bin/console system:config:set core.httpCache.warmUpEnabled true
# Production Build
./bin/build-storefront.sh
# Mit Optimierung
NODE_ENV=production npm run build
docker compose exec app bin/console cache:clear
docker compose exec app bin/console cache:warmup
docker compose exec -u root app chown -R shopware:shopware /var/www/html
# Health Check
docker compose ps mysql
# Logs prüfen
docker compose logs mysql
# Verbindung testen
docker compose exec app nc -zv mysql 3306