Sign inSign up

corbinu/magento

By corbinu

•Updated over 10 years ago

Docker magento 1.9 and 1.6 container for development

Image
3

800

corbinu/magento repository overview

⁠Docker image for Magento

This repo creates a Docker image for Magento⁠.

Based on https://github.com/mageinferno/docker-magento2-php⁠ and https://github.com/alexcheng1982/docker-magento⁠

⁠Magento version

1.9.2.4

⁠How to use

⁠Use as standalone container

You can use docker run to run this image directly.

docker run -p 80:80 corbinu/magento

Then finish Magento installation using web UI. You need to have an existing MySQL server.

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

⁠Use Docker Compose

Docker Compose⁠ is the recommended way to run this image with MySQL database.

A sample docker-compose.yml can be found in this repo.

version: '2'

services:
  web:
    build: .
      ports:
        - "8888:80"
    depends_on:
      - db
    env_file:
      - env

  db:
    image: mariadb:10.1.10
      ports:
        - "3306:3306"
      env_file:
        - env
      depends_on:
        - dbdata
      volumes_from:
        - dbdata

  dbdata:
    image: tianon/true
      volumes:
        - /var/lib/mysql

Then use docker-compose up -d to start MySQL and Magento server.

⁠Magento installation script

Installation script for Magento sample data is also provided.

Use /usr/local/bin/mage-setup to install sample data for Magento.

docker exec -it <container id> mage-setup

This script can install Magento without using web UI. This script requires certain environment variables to run:

Environment variableDescriptionDefault value (used by Docker Compose - env file)
MSETUP_DB_HOSTMySQL hostmysql
MYSQL_DATABASEMySQL db name for Magentomagento
MYSQL_USERMySQL usernamemagento
MYSQL_PASSWORDMySQL passwordmagento
MAGENTO_LOCALEMagento localeen_US
MAGENTO_TIMEZONEMagento timezoneAmerica/New_York
MAGENTO_DEFAULT_CURRENCYMagento default currencyUSD
MAGENTO_URLMagento base urlhttp://magento.docker⁠
MAGENTO_ADMIN_FIRSTNAMEMagento admin firstnameAdmin
MAGENTO_ADMIN_LASTNAMEMagento admin lastnameMyStore
MAGENTO_ADMIN_EMAILMagento admin email[email protected]⁠
MAGENTO_ADMIN_USERNAMEMagento admin usernameadmin
MAGENTO_ADMIN_PASSWORDMagento admin passwordmagentorocks1
MSETUP_USE_SAMPLE_DATAInstall sample data or notfalse

If Docker Compose is used, you can just modify env file in the same directory of docker-compose.yml file to update those environment variables.

After calling mage-setup, Magento is installed and ready to use. Use provided admin username and password to log into Magento backend.

⁠Magento sample data

Magento 1.9 sample data is compressed version from Vinai/compressed-magento-sample-data⁠. Magento 1.6 uses the official sample data⁠.

⁠OS X / Dinghy

To use this image on other systems for local development, create a Dockerfile with anything specific to your local development platform.

For example, if using Dinghy⁠ on OS X, use:

FROM mageinferno/magento2-php:[TAG]
RUN usermod -u 501 www-data

Then build your custom image:

docker build -t myname/php .

Remember to add your VIRTUAL_HOST environment variable to the web server container in your docker-compose.yml file, and remove ports as those are automatically exposed in Dinghy.

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

Tag summary

Content type

Image

Digest

Size

203.4 MB

Last updated

over 10 years ago

docker pull corbinu/magento