Docker images built for Magento
Switch branches/tags
Nothing to show
Clone or download
Latest commit b2fd0b6 Aug 17, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
1.x Option to set uid/gid of apache Jul 27, 2016
2.x Option to set uid/gid of apache Jul 27, 2016
LICENSE Cronjob for Docker Jul 13, 2016 Fix typo Aug 17, 2016

Supported tags and respective Dockerfile links

Production build

Sandbox build

What is this ?

Docker container built with CentOS 7, NGINX and PHP with compatible version and modules for Magento

Sandbox build for Magento 2.x (2-dev) comes with composer, nodejs, grunt.

These are the Docker Hub autobuild images located here.

Magento Logo

How to start

The Simplest way, NginX - PHP-FPM by default

  1. Pull the latest image
$ docker pull locnh/docker-magento
  1. Create container
$ docker run --name magento -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento

That's it !

More Options

Using Apache (httpd) instead of NginX

  • Just add the environment variable with -e WEB_SRV=apache or -e WEB_SRV=httpd

  • Example:

    $ docker run --name magento -e WEB_SRV=httpd -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento

Set the uid (and/or gid) of apache inside container

  • To change the apache uid, use -e UID=<your uid> (you can use this).

  • To change the apache gid, use -e GID=<your gid> (use at your own risk).

  • Example:

    $ docker run --name magento -e UID=501 -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento

Enable Xdebug remote (Sandbox build only)

  • Just add the environment variable with -e XDEBUG_RHOST=<REMOTE_HOST>.

  • Example your IDE is running at IP

    $ docker run --name magento -e XDEBUG_RHOST= -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento

Mountable Volumes

Beside Webroot /var/www/html, you can use option -v to mount more volumes to the container such as services logs:

  • NginX logs: /var/log/nginx
  • Apache logs: /var/log/httpd
  • PHP-FPM logs: /var/www/php-fpm

Please keep in mind

If you don't specify tag, default tag is latest. In case you need the build for specified version of magento, use the version as tag. For example, if you need a container to run:

  • Magento 2.x:

    $ docker run --name magento -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento:2
  • Magento 1.x:

    $ docker run --name magento -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento:1


  1. Fork me
  2. Make changes
  3. Create pull request
  4. Grab a cup of coffee