alexcheng1982 / docker-magento2

Docker image for Magento Open Source 2
MIT License
382 stars 256 forks source link

Data not persistent after container restart #13

Open amitpoonia404 opened 6 years ago

amitpoonia404 commented 6 years ago

There should be a directory on host mounted on /var/www/html of container where the code resides persistently and should not be deleted when container is restarted.

something like: volumes: -./code:/var/www/html

alexcheng1982 commented 6 years ago

If you want to modify Magento files, refer to this section about how to do it.

Morgy93 commented 6 years ago

Yeah but everytime you edit the volumes or something you need to reinstall the magento, since the data is not persistent.

alexcheng1982 commented 6 years ago

Data persistence is a long-standing issue with this Docker image. I hope I can get some solid docs about this topic out soon.

On Fri, Mar 9, 2018 at 2:05 AM, Morgy93 notifications@github.com wrote:

Yeah but everytime you edit the volumes or something you need to reinstall the magento, since the data is not persistent.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alexcheng1982/docker-magento2/issues/13#issuecomment-371480939, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHgELeFmom6HwVJjgIOPQEyqNIltXXaks5tcSyBgaJpZM4Rfulu .

-- Regards Alex Cheng

peter-brennan commented 6 years ago

Any work around to this issue?

vy-shmal commented 6 years ago
version: '3.0'
services:
  web:
    image: alexcheng/magento2
    ports:
      - "80:80"
    links:
      - db
    env_file:
      - env
    volumes:
      - magento-data:/var/www/html
      - D:/mypathtomagento/app/code:/var/www/html/app/code   
  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:
  magento-data:

I added another one named volume, and attached it to the web container. It solved the issue with the reinstall. But I haven't tested it for too long.