Getting Started with Docker
  • Updated on 13 Jan 2020
  • 6 minutes to read
  • Print
  • Share
  • Dark
    Light

Getting Started with Docker

  • Print
  • Share
  • Dark
    Light

This guide will help you to run the spryker script on Linux, MacOS and Windows.

When working with Windows, use absolute paths while running commands. For example: mkdir /d/spryker && cd $_ or mkdir /c/Users/spryker && cd $_.

Demo Mode

  1. Open a terminal.
In case you are going to run the script on Windows, open Ubuntu (For more details, see the Install Docker Desktop section in Docker Install Prerequisites - Windows.)
  1. Create a new folder and navigate into this folder.
  2. Depending on the desired shop type:

a. Clone the B2C repository:

git clone https://github.com/spryker-shop/b2c-demo-shop.git -b 201907.0 --single-branch ./

b. Clone the B2B repository:

git clone https://github.com/spryker-shop/b2b-demo-shop.git -b 201907.0 --single-branch ./
  1. Clone the docker repository:
git clone [email protected]:spryker/docker-sdk.git -b 1.2.2 --single-branch docker
Make sure docker 18.09.1+ and docker-compose 1.23+ are installed.
  1. Bootstrap local docker setup for demo:
docker/sdk bootstrap
  1. Once the job finishes, build and start the instance:
docker/sdk up
  1. Update the hosts file:
  • Linux/MacOS:
echo "127.0.0.1 zed.de.demo-spryker.com yves.de.demo-spryker.com glue.de.demo-spryker.com zed.at.demo-spryker.com yves.at.demo-spryker.com glue.at.demo-spryker.com zed.us.demo-spryker.com yves.us.demo-spryker.com glue.us.demo-spryker.com mail.demo-spryker.com scheduler.demo-spryker.com queue.demo-spryker.com" | sudo tee -a /etc/hosts
If needed, add corresponding entries for other stores. For example, if you are going to have a US store, add the following entries: zed.us.demo-spryker.com glue.us.demo-spryker.com yves.us.demo-spryker
  • Windows:
    1. Click StartSearch and type "Notepad".
    2. Right-click Notepad and select the Run as administrator option.
    3. In the User Account Control window click Yes to confirm the action.
    4. In the upper navigation panel, select FileOpen.
    5. Put the following path into the address line: C:\Windows\System32\drivers\etc
    6. In the File name line, enter "hosts" and click Open.
      The hosts file is opened in the drop-down.
    7. Add the following line into the file:
      127.0.0.1 zed.de.demo-spryker.com glue.de.demo-spryker.com yves.de.demo-spryker.com scheduler.demo-spryker.com mail.demo-spryker.com queue.demo-spryker.com
    If needed, add corresponding entries for other stores. For example, if you are going to have a US store, add the following entries: zed.us.demo-spryker.com glue.us.demo-spryker.com yves.us.demo-spryker.com
    1. Click FileSave.
    2. Close the file.
Depending on the hardware performance, the first project launch can take up to 20 minutes.

Development Mode

  1. Open a terminal.
In case you are going to run the script on Windows, open Ubuntu (For more details, see the Install Docker Desktop section in Docker Install Prerequisites - Windows.)
  1. Create a new folder and navigate into this folder.
  2. Depending on the desired shop type:

a. Clone the B2C repository:

git clone https://github.com/spryker-shop/b2c-demo-shop.git -b 201907.0 --single-branch ./

b. Clone the B2B repository:

git clone https://github.com/spryker-shop/b2b-demo-shop.git -b 201907.0 --single-branch ./
  1. Clone the docker repository:
git clone [email protected]:spryker/docker-sdk.git -b 1.2.2 --single-branch docker
Make sure docker 18.09.1+ and docker-compose 1.23+ are installed.
  1. Bootstrap local docker setup:
docker/sdk bootstrap deploy.dev.yml
  1. Once the job finishes, build and start the instance:
docker/sdk up
  1. Update the hosts file:
  • Linux/MacOS:
echo "127.0.0.1 zed.de.demo-spryker.com yves.de.demo-spryker.com glue.de.demo-spryker.com zed.at.demo-spryker.com yves.at.demo-spryker.com glue.at.demo-spryker.com zed.us.demo-spryker.com yves.us.demo-spryker.com glue.us.demo-spryker.com mail.demo-spryker.com scheduler.demo-spryker.com queue.demo-spryker.com" | sudo tee -a /etc/hosts
If needed, add corresponding entries for other stores. For example, if you are going to have a US store, add the following entries: zed.us.demo-spryker.com glue.us.demo-spryker.com yves.us.demo-spryker
  • Windows:
    1. Click StartSearch and type "Notepad".
    2. Right-click Notepad and select the Run as administrator option.
    3. In the User Account Control window click Yes to confirm the action.
    4. In the upper navigation panel, select FileOpen.
    5. Put the following path into the address line: C:\Windows\System32\drivers\etc
    6. In the File name line, enter "hosts" and click Open.
      The hosts file is opened in the drop-down.
    7. Add the following line into the file:
      127.0.0.1 zed.de.demo-spryker.com glue.de.demo-spryker.com yves.de.demo-spryker.com scheduler.demo-spryker.com mail.demo-spryker.com queue.demo-spryker.com
    If needed, add corresponding entries for other stores. For example, if you are going to have a US store, add the following entries: zed.us.demo-spryker.com glue.us.demo-spryker.com yves.us.demo-spryker.com
    1. Click FileSave.
    2. Close the file.
Depending on the hardware performance, the first project launch can take up to 20 minutes.

Learn more about development mode in Spryker in Docker - Development Mode.

SSL Mode

  1. Set the value of docker: ssl: enable: property to true in deploy.yml (or deploy.dev.yml if needed).
...
docker:
    ssl:
        enabled: true
...
  1. Apply the changes:
docker/sdk bootstrap deploy.yml
Make sure to use the name of the file from step 1.
  1. Run the script to build and restart containers with SSL settings.
docker/sdk up

While running the script, you should see the following output:

Generating a RSA private key
....................................................+++++
..............+++++
writing new private key to '/certs/spryker_ssl.key'
-----
Signature ok
subject=C = DE, ST = Berlin, L = Berlin, OU = Spryker, O = Spryker, CN = Spryker
Getting CA Private Key
Checking chain
/certs/spryker_ssl.crt: OK
  1. In the meanwhile, if you haven't installed the CA certificate, take spryker.crt from /docker/deployment/default/ and follow the instructions in HowTo - Install Self-Signed SSL Certificates .

Using MySQL instead of PostgreSQL

  1. Set the value of services:database:engine: property to mysql in deploy.yml (or deploy.dev.yml if needed).
...
services:
    database:
        engine: mysql
...
  1. Apply the changes:
docker/sdk bootstrap deploy.yml
Make sure to use the name of the file from step 1.
  1. Run the script to build and restart containers with MySQL settings:
shelldocker/sdk up

Endpoints

To ensure that the installation is successful, make sure you can open the following endpoints:
  • yves.de.demo-spryker.com, yves.at.demo-spryker.com, yves.us.demo-spryker.com - Shop UI (storefront)
  • zed.de.demo-spryker.com, zed.at.demo-spryker.com, zed.us.demo-spryker.com - Back-office UI (administration interface)
  • glue.de.demo-spryker.com, glue.at.demo-spryker.com, glue.us.demo-spryker.com - API endpoint
  • scheduler.demo-spryker.com - Jenkins
  • queue.demo-spryker.com - RabbitMQ UI (queue).
Use "spryker" as a username and "secret" as a password. They are defined in your deploy.yml.
  • mail.demo-spryker.com - Mailhog UI (email catcher)

Useful Commands

Run the docker/sdk help command to get the full and up-to-date list of commands.

The following commands are used to manage Docker-based Spryker applications:

  1. boot - Initialize docker setup for the project. Aliases: bootstrap
  2. build - Build Spryker images.
  3. clean - Stop containers, and remove all Spryker images and volumes. Aliases: remove.
  4. clean-data - Remove all Spryker volumes including all storages.
  5. cli - Start a new container where you can run cli commands.
  6. cli <command> - Run a cli command, e.g. docker/sdk cli composer install.
  7. console - Run a Spryker console command, e.g. docker/sdk console code:test -vvv -g Acceptance.
  8. codecept - Start a new container where you can run Codeception commands in the test environment.
  9. code-checks - Run code checks.
  10. demo-data - Populate Spryker demo data. Aliases: demo
  11. down - Stop all Spryker containers. Aliases: stop.
  12. help - Show help page.
  13. jobs - Generate and start jobs.
  14. logs - Tail all application exception logs.
  15. pull - Pull external docker images.
  16. reset - Remove and build all Spryker images and volumes.
  17. restart - Restart Spryker containers.
  18. run - Run Spryker containers. Aliases: start.
  19. testing - Start a new container where you can run cli commands in testing environment, e.g. codecept build.
  20. testing <command> - Run a cli command in testing environment, e.g. docker/sdk codecept codecept build.
  21. up - Build and run Spryker apps based on demo data.
  22. wait - Wait for requested services, e.g. docker/sdk wait database broker.

Arguments:

  • -v - Enable verbose mode.
    You can set the environment variable VERBOSE=1 instead of using this option.
  • -x - Enable Xdebug.
    You can set the environment variable SPRYKER_XDEBUG_ENABLE=1 instead of using this option.
  • -t - Enable testing mode.
    You can set environment variable SPRYKER_TESTING_ENABLE=1 instead of using this option.
Was this article helpful?