Magento Cloud Starter

Setting Up a Local Magento Cloud 2.2 Local Development Environment Using Docker

Setting up a Magento 2.2 EE (Cloud Version) Local Development Environment Using Docker.

Docker offers several advantages over traditional local development environments such as XAMPP, WAMP, MAMP or a LAMP environment configured to run on your local machine by installing each individual component by itself (e.i, Linux, Apache Server, MySQL and PHP). Some of the advantages Docker offers over the mentioned development environment are the following:

Portability – Once Docker has been configured to run a specific development environment, the same environment can be ported to any machine running Docker, regardless of OS.

  1. Ability to replicate your production environment locally – this guarantees that any code written and tested in the local development environment runs without issues once pushed over to the production environment.
  2. Performance – Docker consumes fewer resources than using a virtual machine since it does not run a virtual machine for each software image installed locally.  Instead, Docker shares the same kernel and other resources, this makes it more performant (compared to other VT machines).
  3. Less maintenance – once you’ve created a Docker file, the file can be modified to accommodate additional requirements such as a new image for a database or new server.
  4. Industry Standard

If you’ve never used Docker, it can take some time to get used to it, the time spent learning it is well worth it. We’ll be using Docker to run our web dev environments.

Getting Started with Docker

To get started with Docker, download Docker from one of the following links and install it on your system:



Follow this video tutorial to install Docker on:



Download Magento 2.2 EE Source

Download the Magento 2.2 EE Source by clicking this link.

Download the Docker Image Files and Run Docker

Once you’ve installed Docker on your machine and downloaded the Magento source code, you are ready to set up your local environment.  Download the following Docker Magento stack files by clicking on the link below.

Docker Stack Files

Put them inside a folder of our choice, usually the one where you’ll run your Magento install from. Once the files have been uncompressed, the folder should have the following structure:

composer (folder with other files)

docker-compose.yml (individual file)

magento2 (empty folder, this is where the Magento 2 source files will be placed)

nginx (folder with other files)

percona (folder with other files)

php-fpm (folder with other files)

phpmyadmin (folder with other files)

README  (individual README file, with all instructions)

Put the Magento source files you downloaded earlier under the magento2 install folder

Start docker, if it has not started automatically.  You should be able to spot Docker icon (the little whale with the containers) on the taskbar (make sure it’s not red, if so, there is a problem with the install).

Once Docker it’s running, fire up your command line interface shell (CygWin, Cmder, or Windows Powershell).

If you’ve installed Docker on Windows 10, it’s recommended that you run docker commands using any of the following CLI shells (or CLI interpreters).

  1. CygWin
  2. Cmder
  3. Windows Powershell might work (natively installed on Windows)

On your command line interface shell, navigate to the root of the folder where the Docker Image Files where placed

The following Linux command should help to navigate to a specific directory path:

cd <directory path>

Once you are at the root of the directory where the Docker Stack Files are at, make sure you run a list command by typing “ls” in your CLI shell.  Make sure you are able to see the docker-compose.yml file once you run the “ls” command, along with the rest of the folders and files.

Run docker-compose.yml by typing the following command on your CLI shell:

docker-compose up -d

This will run the download and install all of the docker images and create the containers needed to run a Magento install locally.  To finalize the installation, follow the next steps.

Installing Magento

To ensure all file permission are set correctly on the NGINX server, access the server’s command line and run the following
commands using your CLI shell:

To show which containers are currently running, type in the following docker command, take note of the nginx web server’s name or container-id:

docker container ps

You should see a list of all the containers currently running. We need to access the web server where Magento will be installed. To do so, run the following command:

docker exec -it <the-nginx-web-servers-container-name-or-container-id> bash

Once you’ve run the command above, you’ll have access to the root of the server. On the server’s CLI shell, run the following commands to change permissions on the folder where Magento will be installed.

cd /data/magento2/httpdocs && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && chown -R :apache . && chmod u+x bin/magento

This will take a while to execute.

cd /data/magento2/httpdocs && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && chown -R :apache . && chmod u+x bin/magento

This will take a while to execute as well.

Setting up Magento

To access the Magento setup wizard, go to the following URL: http://localhost:8000 or http://ipofthedockerserver:8000

Proceed with the installation using the Magento setup wizard.

Troubleshooting Docker

Removing images:

docker rmi <image name or id>  (sometimes you’ll have to have to try either the image id or name when there are image dependencies)

docker rmi -f <image name or id> (to force the removal of the image, use when you don’t care about image dependencies)


General Docker Clean Up other References

Follow this link. 

Read more →