aspendigital / docker-octobercms

Dockerized October CMS: PHP, Composer, October core and dependencies
MIT License
150 stars 54 forks source link

Page empty #21

Closed zhouhao27 closed 5 years ago

zhouhao27 commented 5 years ago

Here is my docker-compose.yml:

version: '3.3'
services:
  web:
    image: aspendigital/octobercms
    restart: always
    container_name: octobermovies
    ports:
      - 8800:80
    volumes:
      - ./storage:/var/www/html/storage
      - ./plugins:/var/www/html/plugins
      - ./themes:/var/www/html/themes

The page will be blank.

Then I change my docker-compose.yml to this:

version: '3.3'
services:
  web:
    image: aspendigital/octobercms
    restart: always
    container_name: octobermovies
    ports:
      - 8800:80
    volumes:
      - ./storage/app:/var/www/html/storage/app
      - ./storage/logs:/var/www/html/storage/logs
      - ./storage/database.sqlite:/var/www/html/storage/database.sqlite
      - ./plugins/myplugin:/var/www/html/plugins/myplugin
      - ./themes/newtheme:/var/www/html/themes/newtheme

It works then.

I noticed it's because the folder will be removed when the folder in host is mapped to a folder in container. Is there a way to keep the data in container? Thanks.

petehalverson commented 5 years ago

You are correct. A volume mount will override subfolders. Using ./storage:/var/www/html/storage will replace all folders that exist in the container.

As you've found explicitly mapping subfolders is the only way around this.

You could extend the entrypoint script to do some filesystem magic, but I don't think that'd be ideal.