2

I am looking for a docker image that can run my already installed Magento 2 instance with php7.

So I have a working Magento 2 installation (previously created with MAMP) and I would like to be able to create a container that will use those already existing files.

Currently, the available images like mageinferno and alankent create a new Magento 2 application from scratch.

I tried to create my own but I'm running into all sort of permission issues in the var folder.

2 Answers 2

6

https://hub.docker.com/r/rafaelcgstz/magento2/

I created some images to Magento, this image to Magento 2 has:

  • PHP 7.0
  • Apache 2.4
  • Composer
  • MariaDB
  • Magerun
  • DevAlias CLI
  • Utils (GIT, VIM, UNZIP, CURL, WGET)

Execute in your terminal, change the MYMAGENTO2 to use the name of your project:

curl -s https://raw.githubusercontent.com/clean-docker/Magento2/master/init | bash -s MYMAGENTO2 clone

If you want to install the Magento 2, use like that:

cd MYMAGENTO2
./shell
rm index.php
install-magento2
5
  • do you have any suggestion to how to create Magento 2 docker Image from scratch ? @Rafael
    – Keyur Shah
    Jan 31, 2017 at 16:10
  • @KeyurShah This image I created to development (mainly in Linux), the better way is using OPCache + MariaDB + PHP 7. To Mac and Windows can use the DevBox Official Docker image of Magento. Jan 31, 2017 at 16:17
  • Thanks for the suggestion , but could you please provide me any link or tutorial to create docker Image . I am sorry for this question , I am beginner in docker so :) @RafaelCorrêaGomes
    – Keyur Shah
    Jan 31, 2017 at 19:32
  • @KeyurShah This link will to help you docs.docker.com/engine/getstarted/step_four Jan 31, 2017 at 20:21
  • 1
    Hi @RafaelCorrêaGomes could you help in this docker image for magento related question magento.stackexchange.com/questions/268318/…
    – Ajwad Syed
    Apr 2, 2019 at 9:40
1

You can use this image from Docker Hub https://hub.docker.com/r/folio3ecommerce/magento-php-apache

There are available tags for 2.4.3-p1, 2.4.4-p2, 2.4.5

The above image includes:

PHP 7.4, 8.1
Apache2
Magento code including Sample data

You just need to pull this image and import the available database (.sql file on container's root directory /var/www/html)

This is a pure fresh Magento instance with Sample Data. Hope this helps!

Sample docker-compose.yml file

version: '3'

services:
  magento:
    image: folio3ecommerce/magento-php-apache:2.4.5
    restart: on-failure
    ports:
      - "${APP_PORT}:80"
    env_file: env/phpfpm.env
    links:
      - db
      - redis
      - elasticsearch
    depends_on:
      - db
    networks:
      - customNetwork
    
  db:
    image: mariadb:10.4
    restart: on-failure
    command: --max_allowed_packet=256M
    ports:
      - "${DB_PORT}:3306"
    env_file: env/db.env
    volumes:
      - dbdata:/var/lib/mysql
    networks:
      - customNetwork

  redis:
    image: redis:5.0-alpine
    restart: on-failure
    ports:
      - "${REDIS_PORT}:6379"
    networks:
      - customNetwork

  elasticsearch:
    image: elasticsearch:7.16.2
    restart: on-failure
    ports:
      - "${ES_PORT}:9200"
      - "${ES_SSL_PORT}:9300"
    volumes:
      - elasticsearchdata:/var/lib/elasticsearch
    environment:
      - "discovery.type=single-node"
      ## Set custom heap size to avoid memory errors
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      ## Avoid test failures due to small disks
      ## More info at https://github.com/markshust/docker-magento/issues/488
      - "cluster.routing.allocation.disk.threshold_enabled=false"
      - "index.blocks.read_only_allow_delete"
    networks:
      - customNetwork

volumes:
  dbdata:
  redisdata:
  elasticsearchdata:

networks:
  customNetwork:
2
  • Thanks @ahsan this image is useful. Can you please confirm if the image also contains required composer version along with some useful tools like vim.
    – mshakeel
    May 22, 2023 at 13:40
  • It does include require composer version but does not include vim in the old images. However, in the 2.4.6 image, nano editor has been added and you can install any editor as well. But you can try to install vim on the image you are using, let me know the results May 24, 2023 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.