
This article describes one of the ways to setup Magento 2 on Windows or Linux. This installation can be used for demo and development purposes.
To proceed you will need:
- Installed Docker and Docker Compose (Windows: https://docs.docker.com/docker-for-windows/install/, Ubuntu: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/)
- Installed PHP (Windows: http://windows.php.net/download/, Linux: http://php.net/downloads.php)
Assuming you’ve installed docker, docker-compose and php, let’s start:
- Download Eleanorsoft Utility and put it inside folder where you want to install Magento2.
- Run the following command in that folder:
php esutil.phar magento2/setupAll --docker-skeleton-path="./" --docker-skeleton-name="magento2" --docker-skeleton-port-prefix="800" --docker-docroot-owner="www-data:www-data" --magento2-domain="127.0.0.1"
See argument description below.
- Copy passwords, url, etc. from console
- Open http://127.0.0.1:8001/ in your browser.
That’s all. Magento 2 is setup. Its code is located inside www/html
folder.
Now let’s describe command arguments:
docker-skeleton-path
– a path to the folder where your project is going to be set up;docker-skeleton-name
– a name of the docker instance;docker-skeleton-port-prefix
– the setup requires 3 open ports to work: web server ({prefix}1
), phpMyAdmin ({prefix}3
) and sftp server ({prefix}4
). In our example, we use prefix “800”. It means that web server is going to run on port 8001, phpMyAdmin – 8003, sftp server – 8004.docker-docroot-owner
– owner of the project files. In most cases, it has to be www-data. This setting is ignored on Windows.magento2-domain
– the domain name on which your store is going to run. Note that Magento 2 does not likelocalhost
as its domain. That’s why we use127.0.0.1
.
During installation, you might get an error about missing PHP extensions. Most of these extensions can be enabled in your php.ini
. If you’re installing Magento 2 on Windows, php.ini
is located inside your Windows folder or PHP folder. On Linux you can find out its location from the command:
php -i | grep php.ini
To run Magento 2 console commands do the following in your console:
- Run (you might need to use sudo):
docker ps
- Find a container with the name of your project and appended
_php
to it. Copy its ID. - Run
docker exec -it --user 33 {copied ID} /bin/bash
inside folder where docker-compose.yml is placed.
- You’re inside docker container and able to run different Magento 2 commands.
To stop or start Magento 2 instance the following commands may be used (with sudo if needed):
docker-compose stop
docker-compose up -d
Related Post
Docker and Magento: Test and...
In this article, we will describe one of the ways to run Magento 2 on Docker. Docker is a...
- July 20, 2017
- By eleanors_admin
- Magento
Search for ALL words in...
By default Magento 2 QuickSearch feature searches for at least one word from the entered...
- August 2, 2017
- By eleanors_admin
- Magento
Speed Up Magento 2 DI...
Here we will describe how to improve standard Magento 2 compilation in order to make it...
- November 29, 2017
- By eleanors_admin
- Magento
PayPal error: We can’t...
There is a bug with PayPal checkout on early versions of Magento 2. Users may see error...
- March 12, 2019
- By eleanors_admin
- Magento