Docker-magento - Docker image for Magento 1.6 to 1.9

Overview

Docker image for Magento 1.x

Docker build

This repo creates a Docker image for Magento 1.x.

Please note

The primary goal of this repo is to create Docker images for Magento 1.x development and testing, especially for extensions and themes development. It lacks essential support for production deployment, e.g. Varnish and Redis. Use this wisely for production deployment.

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

Magento versions

Version Git branch Tag name
1.9.3.8 master latest
1.9.1.1 1.9.1.0 1.9.1.0
1.8.1.0 1.8.1.0 1.8.1.0
1.7.0.2 1.7.0.2 1.7.0.2
1.6.2.0 1.6.2.0 1.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/html 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: '3.0'

services:
  web:
    image: alexcheng/magento
    ports:
      - "80:80"
    links:
      - db
    env_file:
      - env
  db:
    image: mysql:5.6.23
    volumes:
      - db-data:/var/lib/mysql/data
    env_file:
      - env
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8580:80"
    links:
      - db
volumes:
  db-data:

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 uses the official sample data.

For Magento 1.7 and 1.8, the sample data from 1.6 doesn't work properly as claimed in the offcial website and causes database errors, so the install-sampledata script is removed for 1.7 and 1.8.

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 variable Description Default value (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_GB
MAGENTO_TIMEZONE Magento timezone Pacific/Auckland
MAGENTO_DEFAULT_CURRENCY Magento default currency NZD
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 [email protected]
MAGENTO_ADMIN_USERNAME Magento admin username admin
MAGENTO_ADMIN_PASSWORD Magento admin password magentorocks1

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 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.

Redis Cache

If you want to use Redis as Cache backend see comments in Dockerfile and bin/install-magento

Modman

Modman is a Magento module manager that allows you to leave your work siloed from the actual Magento codebase via symlinks. With modman, you can sync plugin or theme work without keeping a persistent volume (or using a hidden volume).

# from htdocs
modman init
modman link /path/to/plugin

And to update symlinks:

modman deploy
Comments
  • can't connect to db

    can't connect to db

    i am using the default env file provided as is.

    $ docker-compose up -d
    $ docker exec -it fdf5f1c2ed47 install-magento
    FAILED
    ERROR: Database connection error.
    

    even if i go to magento gui to install, i ca't go further than the Configuration > Database Connection step. I get the error "Database connection error.".

    i am missing something?

    opened by dciccale 8
  • Magento 1.7 looks broken

    Magento 1.7 looks broken

    On Magento 1.7 When I try to add a item to the cart I receive one error Cannot add the item to shopping cart.

    or when I try to reindex the index I get an different Error:

    root@bc63c5d0bb6c:/var/www/htdocs/var/log# cat exception.log
    2016-11-17T15:25:49+00:00 DEBUG (7): Exception message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.catalog_product_index_group_price' doesn't exist
    Trace: #0 /var/www/htdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
    #1 /var/www/htdocs/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #2 /var/www/htdocs/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
    #3 /var/www/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('DELETE FROM `ca...', Array)
    #4 /var/www/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('DELETE FROM `ca...', Array)
    #5 /var/www/htdocs/lib/Zend/Db/Adapter/Abstract.php(661): Varien_Db_Adapter_Pdo_Mysql->query('DELETE FROM `ca...')
    #6 /var/www/htdocs/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php(470): Zend_Db_Adapter_Abstract->delete('catalog_product...')
    #7 /var/www/htdocs/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php(380): Mage_Catalog_Model_Resource_Product_Indexer_Price->_prepareGroupPriceIndex()
    #8 /var/www/htdocs/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Price->reindexAll()
    #9 /var/www/htdocs/app/code/core/Mage/Index/Model/Process.php(209): Mage_Index_Model_Indexer_Abstract->reindexAll()
    #10 /var/www/htdocs/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
    #11 /var/www/htdocs/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(124): Mage_Index_Model_Process->reindexEverything()
    #12 /var/www/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Index_Adminhtml_ProcessController->reindexProcessAction()
    #13 /var/www/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('reindexProcess')
    #14 /var/www/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
    #15 /var/www/htdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
    #16 /var/www/htdocs/app/Mage.php(683): Mage_Core_Model_App->run(Array)
    #17 /var/www/htdocs/index.php(87): Mage::run('', 'store')
    #18 {main}
    
    opened by bertonha 6
  • Unable to install magento 1.6.2

    Unable to install magento 1.6.2

    I updated the docker-compose.yml to use alexcheng/magento:1.6.2.0 as the image. Ran docker-compose up -d and the containers did come up. However, on running install-magento (after installing sample data) I am getting following error -

    FAILED ERROR: Database server does not support the InnoDB storage engine.

    opened by shahdewang 3
  • Error Installing Sample Data and Magento

    Error Installing Sample Data and Magento

    How would I mount to the magento data files so I can edit the files?

    How do you do this - it doesn't seem like there is a way to do this via your setup?

    opened by brandontamm 2
  • Adding Modman and organizing Dockerfile, updating docker-compose to V2 + explicit mysql dependency

    Adding Modman and organizing Dockerfile, updating docker-compose to V2 + explicit mysql dependency

    This PR adds a few things that may improve dev experience.

    Dockerfile

    • Added modman to image, to improve ease of development
    • Re-organizing for spacing
    • Moved the redis conf to the bottom, so toggling will allow Docker to build the image with fewer uncaches steps.

    docker-compose

    • Updated to V2 format
    • Added depends_on for mysql to form explicit dependency chaining on startup (was running into issues with web container connecting)
    opened by silverman63 1
  • Unsupported config option for web: 'mysql'

    Unsupported config option for web: 'mysql'

    This is my first attempt at grokking docker-machine, docker-compose.yml and magento, so forgive me if this question is out of scope.

    I have set up my docker instance like so:

    docker-machine create -d virtualbox magento-machine docker-machine env magento-machine eval (docker-machine env magento-machine) fish shell sh start.sh

    # start.sh
    eval $(ssh-agent)
    ssh-add ~/.docker/machine/machines/magento-machine/id_rsa
    rsync -avzhe ssh --relative --omit-dir-times --progress ./ docker@$(docker-machine ip magento-machine):$(pwd)
    docker-compose up
    
    #docker-compose.yml
    web:
      image: alexcheng/magento
      ports:
        - "80:80"
      links:
        - mysql
      env_file:
        - env
      mysql:
        image: mysql:5.6.23
        env_file:
          - env
    

    the result of sh start.sh is the following:

    [I]  magento-machine  ~/w/magento-machine  sh start.sh                 268ms  Thu Oct 13 09:59:39 2016
    Agent pid 16505
    Identity added: /Users/bennyp/.docker/machine/machines/magento-machine/id_rsa (/Users/bennyp/.docker/machine/machines/magento-machine/id_rsa)
    The authenticity of host 'XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX)' can't be established.
    ECDSA key fingerprint is XXXXXXX.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'XXX.XXX.XXX.XXX' (ECDSA) to the list of known hosts.
    building file list ... 
    3 files to consider
    
    sent 123 bytes  received 20 bytes  95.33 bytes/sec
    total size is 361  speedup is 2.52
    ERROR: The Compose file './docker-compose.yml' is invalid because:
    Unsupported config option for web: 'mysql'
    

    I would appreciate any guidance you're able to provide.

    opened by bennypowers 1
  • How to use this repo for windows 10?

    How to use this repo for windows 10?

    when i ran following commands i'm getting following issues. $ docker-compose up -d Pulling mysql (mysql:5.6.23)... 5.6.23: Pulling from library/mysql

    95caeb02: Pulling fs layer bfd4d273: Pulling fs layer 4764414d: Pulling fs layer 44cb6556: Pulling fs layer d6fa1e8b: Pulling fs layer c70d8b44: Pulling fs layer ab2827b0: Pulling fs layer 986d5d45: Pulling fs layer Digest: sha256:6e1cbc80b84c5b9925793c5b341ade007f9203d1d097e3a952003b93f0a09ecd 888 B/888 BkBBB Status: Downloaded newer image for mysql:5.6.23 Creating admin_mysql_1 Creating admin_web_1

    ERROR: for web Cannot start service web: driver failed programming external connectivity on endpoint admin_web_1 (53d1ea46d846742e651cfafbb89a81c047b00fcd69c3432f794550f3e67ba224): Bind for 0.0.0.0:80 failed: port is already allocated ERROR: Encountered errors while bringing up the project.

    $ docker exec -it 666674054a8d install-sampledata rpc error: code = 2 desc = oci runtime error: exec failed: exec: "install-sampledata": executable file not found in $PATH

    opened by sivajik34 1
  • Database credentials on first install

    Database credentials on first install

    Tried the credentials from the github readme and still couldn't pass this step. What am i doing wrong? Screenshot: https://www.dropbox.com/s/d9nnkfv9qj73qlz/Screenshot%202015-06-03%2017.15.38.png?dl=0

    opened by zeljkoprsa 1
  • added options for using Redis as Cache backend

    added options for using Redis as Cache backend

    I wanted to use Redis as Cache backend so I added some configs for it. Disabled by default.

    Its quite simple: uncomment the "redis" lines in Dockerfile and bin/install-magento. Optionally you can edit redis.conf file to your needs. It has default values from app/etc/local.xml.additional

    opened by philicious 0
  • Intermittent issue when automatically configuring Magento 1.9 with selenium c# web driver

    Intermittent issue when automatically configuring Magento 1.9 with selenium c# web driver

    I seem to be having an intermittent issue when automatically attempting to configure Magento using selenium. I ran a test to automatically populate fields and setup the database and when I invoke submit I get an error saying error occurred during request processing.

    It happens intermittently and I have no clue how to troubleshoot it.

    opened by akash3456 0
  • no admin

    no admin

    After docker-compose up -d and running install-sampledata and install-magento, I can't log into localhost/admin with the creds specified in the readme.

    Am I missing something? What will make it clearer what's going on?

    opened by dansgithubuser 0
  • clarity on how to edit host file

    clarity on how to edit host file

    Readme says: "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."

    Could you give an example of this? Like if docker ps says

    CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                            NAMES
    ce9f87205e1e        phpmyadmin/phpmyadmin   "/run.sh supervisord…"   3 minutes ago       Up 3 minutes        9000/tcp, 0.0.0.0:8580->80/tcp   docker-magento_phpmyadmin_1
    4a9bd10b280a        alexcheng/magento       "/sbin/my_init"          3 minutes ago       Up 3 minutes        0.0.0.0:80->80/tcp               docker-magento_web_1
    f5caee2ac173        mysql:5.6.23            "/entrypoint.sh mysq…"   3 minutes ago       Up 3 minutes        3306/tcp                         docker-magento_db_1
    

    and I've used the default settings, then how should the line in my host file look?

    I'm assuming this will solve the symptom "website can't be reached after running install-magento".

    opened by dansgithubuser 1
  • SOAP-ERROR: Parsing WSDL

    SOAP-ERROR: Parsing WSDL

    client = Savon.client(wsdl: "http://local.magento/api/v2_soap/index?wsdl=1", read_timeout: 300)
    
    params = {:message=>{:username=>"myuser", :api_key=>"randomapikey123"}}
    client.operations # works. Lists all operations
    
    client.call(:login, params) 
    

    The last line gives following Error

    Savon::SOAPFault: (WSDL) SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://local.magento/index.php/api/v2_soap/index/?wsdl=1' : failed to load external entity "http://local.magento/index.php/api/v2_soap/index/?wsdl=1"

    The port mappings is 80:80

    As you can see, it adds /index.php to the host

    Similar issue with Vagrant https://github.com/rjbaker/simple-magento-vagrant/issues/7

    opened by amitpatelx 0
  • Wrong admin login

    Wrong admin login

    Hey Alex, nice work here, congrats!

    Well.. I'm trying to login into magento admin panel using my username and password configured on my env variables.

    Take a look:

    environment:
          MYSQL_HOST: magento_db
          MYSQL_DATABASE: magento
          MYSQL_USER: root
          MYSQL_PASSWORD: root
          MAGENTO_LOCALE: en_US
          MAGENTO_TIMEZONE: America/Sao_Paulo
          MAGENTO_DEFAULT_CURRENCY: USD
          MAGENTO_ADMIN_USERNAME: ebanx
          MAGENTO_ADMIN_PASSWORD: ebanx123
          MAGENTO_ADMIN_FIRSTNAME: EBANX
          MAGENTO_ADMIN_LASTNAME: Store
          MAGENTO_ADMIN_EMAIL: [email protected]
          MAGENTO_URL: http://localhost
    

    When I go to http://localhost/admin and fill with ebanx username and ebanx123 password, the magento shows Invalid User Name or Password.. Why?

    image

    opened by cezarsmpio 4
Releases(v1.0.0)
Owner
Fu Cheng
Full stack developer @ Auckland, New Zealand
Fu Cheng
Docker-magento2 - 🐳 Docker containers with all required Magento 2 dependencies installed available as FPM through Nginx and CLI

Magento 2 Docker A collection of Docker images for running Magento 2 through nginx and on the command line. Quick Start cp composer.env.sample compose

Meanbee 454 Dec 27, 2022
🐋📦✂️📋📦 Docker image of packagist mirror

Docker for Packagist Mirror This project allows you to easily create and update a mirror of the packagist having as dependency only the docker. It is

Webysther Nunes 28 Jan 20, 2022
Docker image that provides static analysis tools for PHP

Static Analysis Tools for PHP Docker image providing static analysis tools for PHP. The list of available tools and the installer are actually managed

Jakub Zalas 1.1k Jan 1, 2023
A complete stack for running Symfony 5 into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.

?? Docker + PHP 7.4 + MySQL8.0 + Nginx + Certbot(HTTPS) + Symfony 5 Boilerplate ?? Edited from https://github.com/ger86/symfony-docker version -> http

null 6 Nov 9, 2022
🐋 This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

?? This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

Anton Kliek 1 Jan 26, 2022
Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates

Magento 2 Image Resizer Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates Installation $ composer require

Stämpfli AG 88 Apr 18, 2022
Production ready scalable Magento setup utilizing the docker

Magento docker image Requirements This docker image expects 2 other linked containers to work . Mysqldb or Mariadb linked as 'db' Memcached linked as

Paim pozhil 49 Jun 21, 2021
A Magento Development Environment Made of Docker Containers

Docker for Magento 1 Extension Development Tl;dr How do I use this? Clone it. Type docker-compose up -d. Install a Magento Mount your file share. Deve

Michael A. Smith 99 May 10, 2021
Mage2click toolset to create and manage the Magento Docker development environment with mutagen.io file-sync for macOS and native filesystem mounts on Linux.

Mage2click - Magento Docker Toolset Mage2click toolset is a system-wide command-line tool for creating and managing simultaneously running Magento Doc

Mage2click 69 Nov 28, 2022
Mark Shust's Docker Configuration for Magento

markshust/docker-magento Mark Shust's Docker Configuration for Magento Table of contents Docker Hub Free Course Usage Prerequisites Setup Updates Cust

Mark Shust 1.8k Jan 8, 2023
OSX/Linux Docker containers installer for Magento 2

Magento 2 OSX/Linux Docker Requirements MacOS: Docker, docker-sync, Git Linux: Docker, Docker-compose, Git on Debian based OS (Example: Ubuntu, Linux

Osiozekhai Aliu 54 Dec 10, 2022
Magento 2.4.4 CE docker compose

REQUIREMENTS Docker https://docs.docker.com/desktop/install/windows-install/ Git https://git-scm.com/download/win STOP LOCAL SERVERS (XAMPP, OPENSERVE

null 5 Sep 11, 2022
CloudFlare Image Resizing plugin for WordPress.

Cloudflare Image Resizing plugin for WordPress The current Cloudflare plugin for WordPress does not replace URL's automatically for you to use the Ima

Norbert Boros 43 Jan 7, 2023
Smd thumbnail - Multiple image thumbnails of arbitrary dimensions

smd_thumbnail Download | Packagist If you’re bored of one Textpattern thumbnail per image and don’t fancy using an auto-resizing script or relying on

Stef Dawson 9 Dec 9, 2021
Tom image grid - Plugin for Textpattern CMS : An optionnal grid display for images tab

tom_image_grid tom_image_grid is a plugin for Textpattern CMS. It allows a more compact display (as a grid) of the images list. The plugin adds two bu

Thomas Jund 5 Jun 30, 2019
Detect the position of a face in an image.

Face Detector PHP GD 를 이용해 이미지의 얼굴 위치를 식별합니다. mauricesvay/php-facedetection 프로젝트를 기반으로 만들었습니다. js 로 포팅하며 개선한 사항들을 적용하여 error_reporting = E_ALL safe 하게

Song Hyo Jin 4 Jul 27, 2022
Simple, image-based, mathematical captcha, with increasing levels of difficulty

simple-captcha Simple, image-based, mathematical captcha, with increasing levels of difficulty version 1.1.0 see also: ModelView a simple, fast, power

Nikos M. 6 Dec 18, 2022