Enjoy Secure & Super Fast Managed Magento Hosting with FREE $25 Credit. Use Promo Code: MGT25
AVAIL NOW

Installing Magento 2 in 5 minutes with Docker

Today we are featuring Hadrien from Occitech with a post on installing Magento 2 in 5 minutes with Docker. The post originally appeared on the Occitech blog and has been translated to English by his colleague Frank.

Introduction

Magento 2 0.42.0-beta1 is available since a few days. In order to take a look at it right away, let’s walk through the process of installing it in 5 minutes sharp thanks to Docker.

The Docker files provided will give you access to either a read-only “discovery mode” instance of Magento 2 to have a play with it, or a “developer mode” which is a Magento 2 development environment you can experiment with.

Docker

Walking through the installation and setup process of Docker is outside the scope of this article. This guide assumes you already have a running and functional Docker-environment set up.

Useful links
What is Docker?
Docker Documentation: Installation
StackOverflow: How is Docker.io different from a normal VM?

Discovery mode

That’s it. Above commands are all that is needed to get the Docker processes set up. Take the port that the last command returned, go to http://127.0.0.1:PORT in your favorite browser and start installing Magento 2.

When asked for database information, set the host to db. The MySQL database and credentials can be found in the command above.

If you stumble upon the following error message: Cannot determine required PHP extensions: Missing key 'platform-dev' in 'composer.lock' file, click on “Try Again” until “Next” is available. Then, at the final step, another message will warn you about an error, don’t pay attention to it; it’s a var_dump still present in the Magento 2 code base.

Developer mode

Setting up the developer mode will be just as quick. The only difference is that Magento 2 will be installed locally. Please note that Composer and fig should already be present on the host system.

Start with creating a new Magento 2 project via Composer:

The fig.yml YAML configuration file for fig can be found below. Don’t forget to change the passwords:

Up next is starting the containers:

Copy the port returned by the last command and navigate to http://127.0.0.1:PORT – if everything went correctly you should be greeted by the Magento 2 setup wizard.

Again, when asked for database information, set the host to db and refer to the MySQL credentials you supplied earlier. As you can locally navigate to the source code, you can simply start coding and the Docker environment will reflect those changes.

And voilà! Hopefully by sharing this you will be able to get your hands on Magento 2 using Docker.

About Author

Chadrien is geek, gamer, and legends say he's also a proud developer at Occitech