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.
- Pull the latest image
$ docker pull locnh/docker-magento
- Create container
$ docker run --name magento -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento
That's it !
-
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
-
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
-
Just add the environment variable with
-e XDEBUG_RHOST=<REMOTE_HOST>
. -
Example your IDE is running at IP
10.0.75.1
:$ docker run --name magento -e XDEBUG_RHOST=172.17.0.1 -v /path/to/magento:/var/www/html -p 80:80 -d locnh/docker-magento
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
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
- Fork me
- Make changes
- Create pull request
- Grab a cup of coffee