Sign inSign up

tlongren/magento

By tlongren

•Updated almost 11 years ago

Magento

Image
1

1.4K

tlongren/magento repository overview

⁠Docker image for Magento

This repo creates a Docker image for Magento⁠.

⁠Magento versions

VersionGit branchTag name
1.9.2.2masterlatest
1.9.1.01.9.1.01.9.1.0
1.8.1.01.8.1.01.8.1.0
1.7.0.21.7.0.21.7.0.2
1.6.2.01.6.2.01.6.2.0

⁠How to use

⁠Use as standalone container

You can use docker run to run this image directly.

docker run -p 80:80 alexcheng/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.

web:
  image: alexcheng/magento
  ports:
    - "80:80"
  links:
    - mysql
  env_file:
    - env
mysql:
  image: mysql:5.6.23
  env_file:
    - env

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

⁠Magento sample data

Installation script for Magento sample data is also provided.

Please note: Sample data must be installed before Magento itself.

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

docker exec -it <container id> install-sampledata

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

⁠Magento installation script

A Magento installation script is also provided as /usr/local/bin/install-magento. 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)
MYSQL_HOSTMySQL hostmysql
MYSQL_DATABASEMySQL db name for Magentomagento
MYSQL_USERMySQL usernamemagento
MYSQL_PASSWORDMySQL passwordmagento
MAGENTO_LOCALEMagento localeen_GB
MAGENTO_TIMEZONEMagento timezonePacific/Auckland
MAGENTO_DEFAULT_CURRENCYMagento default currencyNZD
MAGENTO_URLMagento base urlhttp://local.magento⁠
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

If you want to use install-magento script and this images is started as a standalone container using docker run, make sure these environment variables are passed in docker run with -e switch.

After Docker container started, use docker ps to find container id of image alexcheng/magento, then use docker exec to call install-magento script.

docker exec -it <container id> install-magento

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 install-magento, Magento is installed and ready to use. Use provided admin username and password to log into Magento backend.

If you use default base url (http://local.magento⁠) or other test url, you need to modify your host file⁠ to map the host name to docker container. For Boot2Docker, use boot2docker ip to find the IP address.

Important: If you do not use the deafult 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

sha256:646ca729e…

Size

280.3 MB

Last updated

almost 11 years ago

docker pull tlongren/magento