Skip to main content

Magento 2 Dev Environment with Docker Compose

Angkor Wat, Cambodia

Getting Started

Download Docker Magento2

Clone the following repository:

cd /opt
sudo git clone https://github.com/fballiano/docker-magento2.git
cd /docker-magento2

Then start all containers with docker-compose - make sure that you have both Docker and Docker Compose installed on your system.

Download Magento2 Source Code

Download Magento 2 in any way you want (zip/tgz from website, composer, etc) and extract in the magento2 subdirectory of this project - right next to the docker-compose.yml!

Spinning up your Containers

sudo docker-compose up -d

Problems

sudo docker-compose up -d
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?

Supported filenames: docker-compose.yml, docker-compose.yaml

Reinstalling Docker Compose

First, confirm the latest version available in their releases page. At the time of this writing, the most current stable version is 1.26.0.

The following command will download the 1.26.0 release and save the executable file at /usr/local/bin/docker-compose, which will make this software globally accessible as docker-compose:

sudo curl -L 'https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)' -o /usr/local/bin/docker-compose

Set the correct permissions so that the docker-compose command is executable:

sudo chmod +x /usr/local/bin/docker-compose

Verify that the installation was successful:

docker-compose --version

docker-compose version 1.26.0, build d4451659

Retry to sudo docker-compose up -d - it should work now.

docker-compose up -d
Creating network 'docker-magento2_default' with the default driver
Creating volume 'docker-magento2_dbdata' with default driver
Pulling db (mariadb:)...
latest: Pulling from library/mariadb
23884877105a: Pull complete
bc38caa0f5b9: Pull complete
2910811b6c42: Pull complete
36505266dcc6: Pull complete

...