I want to setup Magento 2 with docker and system of containers are ubuntu.

Can anyone help me, how to setup docker file?


4 Answers 4


I've been using for the last 6 months the docker images created by Fabrizio Balliano It works nicely on ubuntu. And you have a readme file explaining what you need to do to get it running.

  • The project readme says "if someday we'll be able to deploy this infrastructure in production..." This implies it is not production-ready. Is it recommended to run Magento 2 in docker on production servers?
    – MountainX
    Commented Dec 7, 2019 at 1:39

You can use these files to setup your docker environment easy to use, visit link below - https://github.com/markoshust/docker-magento

You can setup on both environments windows and mac. I hope so it will help you.

  • I followed this but they do not provide sufficient information for the setup on Linux. Facing challenges with MySQL connection. Most probably due to available ports Commented Dec 6, 2021 at 14:05

I am following Magento Commerce Cloud > Docker development > Launch Docker > Developer mode so that I can stay updated with the official Magento docker development. Working fine in MacOS for me. I have tested both Magento Commerce and Open Source.

In order to work with Open Source version I had to do few tweaking while following Developer mode:

  1. While you are done with the Step#1
    Download a Magento application template from the Magento Cloud repository.
    you should get a composer.json and a composer.lock in the directory. You will need to replace those two files with your preferable composer.json and composer.lock files if you like contributing to the Magento 2 Code Base. Or you may take a copy of those files generated during installing Magento using Composer.
  2. In Step#5
    In your local environment, generate the Docker Compose configuration file.
    while running the following command you may get the ece-docker not found error:
$ ./vendor/bin/ece-docker build:compose --mode="developer" --sync-engine="mutagen" --php 7.3

-bash: ./vendor/bin/ece-docker: No such file or directory

In order to solve that you will need to add `magento/magento-cloud-docker`:
$ composer require magento/magento-cloud-docker

Now you should be able to build the configuration.

You may need to edit the docker.compose.yml file to meet your needs.

  1. In Step#10
    Install Magento in your Docker environment
you should encounter the following error:

Could not open input file: ./vendor/bin/ece-tools Solve that with

$ composer require magento/ece-tools
  1. Follow the rest of the steps accordingly. And you should be done.
  • still i'm getting error ./vendor/bin/ece-tools
    – sivakumar
    Commented Feb 5, 2021 at 3:54
  • @sivakumar What error were you getting?
    – itsazzad
    Commented Feb 5, 2021 at 9:19

Magento2 with nginx + varnish https://hub.docker.com/r/meanbee/magento2-varnish

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.