Integrating Docker into an Existing Project
This page describes how you can convert an existing non-docker based project into a docker based one. If you want to install Spryker Commerce OS in Docker from scratch, start from here.
Prerequisites
To start Docker integration into your project, overview and install the necessary features:
| Name | Feature | Required sub-feature | 
|---|---|---|
| Spryker Core | 201907.0 | 
Set up .dockerignore
Create a new .dockerignorefile to match the project file structure.
.git
.idea
node_modules
/vendor
/data
!/data/import
.git*
.unison*
/.nvmrc
/.scrutinizer.yml
/.travis.yml
/newrelic.ini
 
/docker
!/docker/deployment/Set up Configuration
Under config/Shared, adjust or create a configuration file which depends on the environment name.
As the Docker configuration file is too big, find a ready-made working example here. Also, the configuration has to be adjusted for specific store(s), e.g config_default-docker_DE.php.
Set up Deploy File
Deploy file is a YAML file defining Spryker infrastructure and services for Spryker tools used to deploy Spryker applications in different environments.
It's possible to create an unlimited amount of deployment files with different configuration settings, e.g deploy.yml for demo mode or deploy.dev.yml for development mode.
Find an example of deploy file for demo mode (DE, AT, and US stores) below:
 deploy.yml
deploy.yml
                                                            version: "0.1"
 
namespace: spryker_b2c
tag: '1.0'
 
environment: docker
image: spryker/php:7.2
 
regions:
    EU:
        services:
            database:
                database: eu-docker
                username: spryker
                password: secret
 
        stores:
            DE:
                services:
                    broker:
                        namespace: de-docker
                    key_value_store:
                        namespace: 1
                    search:
                        namespace: de_search
            AT:
                services:
                    broker:
                        namespace: at-docker
                    key_value_store:
                        namespace: 2
                    search:
                        namespace: at_search
    US:
        services:
            database:
                database: us-docker
                username: spryker
                password: secret
        stores:
            US:
                services:
                    broker:
                        namespace: us-docker
                    key_value_store:
                        namespace: 3
                    search:
                        namespace: us_search
groups:
    EU:
        region: EU
        applications:
            yves_eu:
                application: yves
                endpoints:
                    yves.de.demo-spryker.com:
                        store: DE
                        services:
                            session:
                                namespace: 1
                    yves.at.demo-spryker.com:
                        store: AT
                        services:
                            session:
                                namespace: 2
            glue_eu:
                application: glue
                endpoints:
                    glue.de.demo-spryker.com:
                        store: DE
                    glue.at.demo-spryker.com:
                        store: AT
            zed_eu:
                application: zed
                endpoints:
                    zed.de.demo-spryker.com:
                        store: DE
                        services:
                            session:
                                namespace: 3
                    zed.at.demo-spryker.com:
                        store: AT
                        services:
                            session:
                                namespace: 4
    US:
        region: US
        applications:
            yves_us:
                application: yves
                endpoints:
                    yves.us.demo-spryker.com:
                        store: US
                        services:
                            session:
                                namespace: 5
            glue_us:
                application: glue
                endpoints:
                    glue.us.demo-spryker.com:
                        store: US
            zed_us:
                application: zed
                endpoints:
                    zed.us.demo-spryker.com:
                        store: US
                        services:
                            session:
                                namespace: 6
services:
    database:
        engine: postgres
        root:
            username: "root"
            password: "secret"
    broker:
        engine: rabbitmq
        api:
            username: "spryker"
            password: "secret"
        endpoints:
            queue.demo-spryker.com:
    session:
        engine: redis
    key_value_store:
        engine: redis
    search:
        engine: elastic
    scheduler:
        engine: jenkins
        endpoints:
            scheduler.demo-spryker.com:
    mail_catcher:
        engine: mailhog
        endpoints:
            mail.demo-spryker.com:
 
docker:
 
    ssl:
        enabled: false
 
    testing:
        store: DE
 
    mount:
        baked:Find an example of deploy file for development mode (DE, AT, and US stores) below:
 deploy.dev.yml
deploy.dev.yml
                                                            version: "0.1"
 
namespace: spryker_b2c_dev
tag: 'dev'
 
environment: docker
image: spryker/php:7.2
 
regions:
    EU:
        services:
            database:
                database: eu-docker
                username: spryker
                password: secret
 
        stores:
            DE:
                services:
                    broker:
                        namespace: de-docker
                    key_value_store:
                        namespace: 1
                    search:
                        namespace: de_search
            AT:
                services:
                    broker:
                        namespace: at-docker
                    key_value_store:
                        namespace: 2
                    search:
                        namespace: at_search
    US:
        services:
            database:
                database: us-docker
                username: spryker
                password: secret
        stores:
            US:
                services:
                    broker:
                        namespace: us-docker
                    key_value_store:
                        namespace: 3
                    search:
                        namespace: us_search
groups:
    EU:
        region: EU
        applications:
            yves_eu:
                application: yves
                endpoints:
                    yves.de.demo-spryker.com:
                        store: DE
                        services:
                            session:
                                namespace: 1
                    yves.at.demo-spryker.com:
                        store: AT
                        services:
                            session:
                                namespace: 2
            glue_eu:
                application: glue
                endpoints:
                    glue.de.demo-spryker.com:
                        store: DE
                    glue.at.demo-spryker.com:
                        store: AT
            zed_eu:
                application: zed
                endpoints:
                    zed.de.demo-spryker.com:
                        store: DE
                        services:
                            session:
                                namespace: 3
                    zed.at.demo-spryker.com:
                        store: AT
                        services:
                            session:
                                namespace: 4
    US:
        region: US
        applications:
            yves_us:
                application: yves
                endpoints:
                    yves.us.demo-spryker.com:
                        store: US
                        services:
                            session:
                                namespace: 5
            glue_us:
                application: glue
                endpoints:
                    glue.us.demo-spryker.com:
                        store: US
            zed_us:
                application: zed
                endpoints:
                    zed.us.demo-spryker.com:
                        store: US
                        services:
                            session:
                                namespace: 6
services:
    database:
        engine: postgres
        root:
            username: "root"
            password: "secret"
        endpoints:
            localhost:5432:
                protocol: tcp
    broker:
        engine: rabbitmq
        api:
            username: "spryker"
            password: "secret"
        endpoints:
            queue.demo-spryker.com:
    session:
        engine: redis
    key_value_store:
        engine: redis
    search:
        engine: elastic
    scheduler:
        engine: jenkins
        endpoints:
            scheduler.demo-spryker.com:
    mail_catcher:
        engine: mailhog
        endpoints:
            mail.demo-spryker.com:
 
docker:
 
    ssl:
        enabled: false
 
    testing:
        store: DE
 
    debug:
        enabled: true
 
    mount:
        native:
            platforms:
                - linux
 
        docker-sync:
            platforms:
                - macos
                - windows
Set up Installation Script
Under config/Shared, prepare the installation recipe that defines the way Spryker should be installed.
Find an installation recipe example below:
 install.yml
install.yml
                                                            env:
    APPLICATION_ENV: docker
 
sections:
    build:
        generate-transfers:
            command: "vendor/bin/console transfer:generate"
 
        twig-cache-warmup:
            command: "vendor/bin/console twig:cache:warmer"
 
        navigation-cache-warmup:
            command: "vendor/bin/console navigation:build-cache"
 
        rest-request-validation-cache-warmup:
            command: "vendor/bin/console glue:rest:build-request-validation-cache"
 
        propel-copy-schema:
            command: "vendor/bin/console propel:schema:copy"
 
        propel-build:
            command: "vendor/bin/console propel:model:build"
 
        generate-entity-transfer:
            command: "vendor/bin/console transfer:generate"
 
        generate-page-index-map:
            command: "vendor/bin/console search:setup:index-map"
 
        translator-generate-cache:
            command: "vendor/bin/console translator:generate-cache"
 
    build-development:
        generate-transfer-databuilders:
            command: "vendor/bin/console transfer:databuilder:generate"
 
        generate-auto-completion:
            command: "vendor/bin/console dev:ide:generate-auto-completion"
 
    build-static:
        dependencies-install:
            command: "vendor/bin/console frontend:project:install-dependencies"
 
        yves-install-dependencies:
            command: "vendor/bin/console frontend:yves:install-dependencies"
 
        yves-build-frontend:
            command: "vendor/bin/console frontend:yves:build"
 
        zed-install-dependencies:
            command: "vendor/bin/console frontend:zed:install-dependencies"
 
        zed-build-frontend:
            command: "vendor/bin/console frontend:zed:build"
 
    scheduler-setup:
        jenkins-generate:
            command: "vendor/bin/console scheduler:setup"
 
    init-storages-per-store:
        setup-search:
            command: "vendor/bin/console setup:search"
 
    init-storages-per-region:
        propel-copy-schema:
            command: "vendor/bin/console propel:schema:copy"
 
        propel-postgres-compatibility:
            command: "vendor/bin/console propel:pg-sql-compat"
 
        propel-migration-delete:
            command: "vendor/bin/console propel:migration:delete"
 
        propel-tables-drop:
            command: "vendor/bin/console propel:tables:drop"
 
        propel-diff:
            command: "vendor/bin/console propel:diff"
 
        propel-migrate:
            command: "vendor/bin/console propel:migrate"
 
        propel-migration-cleanup:
            command: "vendor/bin/console propel:migration:delete"
 
        init-database:
            command: "vendor/bin/console setup:init-db"
 
    demodata:
        import:
            command: "vendor/bin/console data:import"
 
        update-product-labels:
            command: "vendor/bin/console product-label:relations:update"Start Developing
Follow the guide to start working with Docker.
See also:
Last review date: Aug 06, 2019