Public Repository

Last pushed: a year ago
Short Description
Magento 1.9 + Wordpress 4.7.3
Full Description

Docker Image for Magento 1.8 - 1.9 Bundled with Wordpress

This repo creates a Docker image with both Magento 1.8 - 1.9.x and Wordpress installed, that should run "out of the box" when used with Docker Compose.

If you want an easy install, it is highly recommended you download the compose files and follow the Docker Compose instructions.

Expected Use

The goal of this repo is to quickly spin up Docker images for development in Magento 1.8.1 - 1.9.x. It's not intended for production deployment.

This repo is only for Magento 1.x. If you are looking for Magento 2.x, check out alexcheng1982/docker-magento2.


This repo was made using code and inspiration from alexcheng1982/docker-magento

Magento Versions

Version Git branch Tag name master latest

How To Use

Magento is installed into /var/www/htdocs folder.
Wordpress is installed into /var/www/htdocs/wp folder.

Docker Compose

Docker Compose is the recommended way to run this image with a MySQL database. Download the compose files and follow the Docker Compose instructions. A sample docker-compose.yml can be found in this repo.

Magento Sample Data & Automated Installation

Installation scripts for Magento are also provided.

Use /usr/local/bin/install-sampledata to install sample data for Magento, and /usr/local/bin/install-magento for the Magento core. It will use the ENV variables during setup.

docker exec -it magento-web install-sampledata
docker exec -it magento-web install-magento

Note on sample data

Magento 1.9 sample data is compressed version from Vinai/compressed-magento-sample-data. Magento 1.8, does not include sample data.

Default environment variables

Environment Variable Description Default (used by Docker Compose - env file)
MYSQL_HOST MySQL host mysql
MYSQL_DATABASE MySQL db name for Magento magento
MYSQL_USER MySQL username magento
MYSQL_PASSWORD MySQL password magento
MAGENTO_LOCALE Magento locale en_US
MAGENTO_TIMEZONE Magento timezone Asia/Tokyo
MAGENTO_DEFAULT_CURRENCY Magento default currency USD
MAGENTO_URL Magento base url http://local.magento
MAGENTO_ADMIN_FIRSTNAME Magento admin firstname Admin
MAGENTO_ADMIN_LASTNAME Magento admin lastname MyStore
MAGENTO_ADMIN_EMAIL Magento admin email
MAGENTO_ADMIN_USERNAME Magento admin username admin
MAGENTO_ADMIN_PASSWORD Magento admin password admin123


If you installed with the default compose file and environment variables, you will need to update your host file to map localhost to local.magento.    local.magento

Important: If you do not use the default MAGENTO_URL you must use a hostname that contains a dot within it (e.g, otherwise the Magento admin panel login won't work.

Working With Data with Kitematic

If you want to work with the data in htdocs (Magento & Wordpress) on your host computer, you will need to first copy the existing data then remap the volume.

docker cp magento-web:/var/www/htdocs ./

Then you can use Kitematic to configure the /var/www/htdocs volume to point to this data that is accessible on the host system. Important: When you configure the volume you will erase everything in /var/www/htdocs so make sure you copy the data BEFORE doing this.

Mysql Database Notes

The default compose file sets up a mysql database that uses a persistant data volume. This means that so long as the image isn't taken down with docker down mangento-mysql or removed from Kitematic, it will retain its data. Here is a cheatsheet of some commands you can run to help manage this data. The following examples assumes you've used the default environment variables.

Backup all your data

docker exec magento-mysql /usr/bin/mysqldump -u root --password=myrootpassword --all-databases > magento-mysql-backup.sql

Restore all your data

cat magento-mysql-backup.sql | docker exec -i magento-mysql /usr/bin/mysql -u root --password=myrootpassword --all-databases

You use the same database running but reinstall the magento-web image and get an error about a table already existing

1 - Log into magento-mysql and run mysql -u root -p and enter the db root password (default = "myrootpassword").
2 - Once logged into the mysql shell, use the command use magento; followed with:

DROP TABLE IF EXISTS `permission_variable`,`permission_block`,`customer_flowpassword`;
Docker Pull Command