- Docker
- Git
- VSCode
Mage2Docker defines a docker-compose
environment for you. As such, we start by cloning the environment in your terminal of choice.
git clone https://www.github.com/graycoreio/mage2docker \
&& cd mage2docker
In case you have not done so, we will add your Magento composer authentication credentials to your user's local auth.json
.
First check to see if you have a credentials file under ~/.composer/auth.json
.
cat ~/.composer/auth.json
If you have a auth.json
file here, you have most likely already configured your credentials and can skip to the next step.
If you don't see your credentials there, you can follow the Magento 2 guide to find your credentials and copy the auth.json.sample
found in the Magento 2 repo to your user's auth.json
file: ~/.composer/auth.json
file and fill out the required credentials.
cp /path/to/magento/project/auth.json.sample ~/.composer/auth.json
We recommend using auth.json
in your user's directory, but when you're working on multiple Magento 2 applications at once, you may need multiple auth.json
. You can simply add the auth.json
to the root of your Magento 2 project after project creation, and composer will use those credentials instead.
Mage2Docker comes with a basic environment configuration file .env.sample
, you can utilize this file to tailor your environment to your needs.
cp .env.sample .env
You will need to uncomment the following configurations and select the appropriate configurations for your environment. We've configured some basic defaults for out-of-the-box behavior.
COMPOSE_PROJECT_NAME
For long-time users, you may note that COMPOSE_FILE is distinctly missing. Don't worry - all the old configuration behaviors previous supported by merging
yml
files together still work with Dolphin anddevcontainer
. This isn't documented quite yet, but we guarantee it will still work!
If you have multiple Magento projects on your system, please ensure that the COMPOSE_PROJECT_NAME value is unique, otherwise you will find out that you've accidentally shared data between different projects and you'll be in for a world of pain.
Add the following entry to your host system's /etc/hosts
file.
127.0.0.1 magento2.test
If you're using WSL2, use this instead. Be sure to do this on the Windows host.
127.0.0.1 magento2.test
[::1] magento2.test
From your mage2docker
repo:
devcontainer open
Now, you should be able to visit https://magento2.test
in your browser and see a fresh Luma Magento store with Venia Sample data!