docker-magento2 icon indicating copy to clipboard operation
docker-magento2 copied to clipboard

Data not persistent after container restart

Open amitpoonia404 opened this issue 6 years ago • 5 comments

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

amitpoonia404 avatar Jan 16 '18 12:01 amitpoonia404

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

alexcheng1982 avatar Jan 17 '18 07:01 alexcheng1982

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

Morgy93 avatar Mar 08 '18 13:03 Morgy93

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 [email protected] 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

alexcheng1982 avatar Mar 08 '18 19:03 alexcheng1982

Any work around to this issue?

peter-brennan avatar May 20 '18 04:05 peter-brennan

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.

vy-shmal avatar May 21 '18 14:05 vy-shmal