docker-library/drupal

Docker compose volumes not working.

Closed this issue · 3 comments

Hello I am trying to install drupal with a docker-compose file but it says it cant create the files and I get forbidden every time I try to access it.

version: "3.7"
services:
  drupal:
    image: drupal:php8.2-apache
    restart: unless-stopped
    container_name: drupal
    ports:
      - 80:80
    volumes:
      - /home/steve/drupal/data:/opt/drupal
    volumes:
      - /home/steve/drupal/data:/opt/drupal

This will replace the /opt/drupal directory inside the container with the /home/steve/drupal/data directory on the host. If /home/steve/drupal/data is empty, then /opt/drupal will be empty in the container, which means there will be no Drupal codebase to serve.

Hello!

(Sorry for late response)

So how I can I make a volume to store my Drupal data? (But still be a bind volume)

Ok I found I need to do this

-v /path/on/host/modules:/var/www/html/modules \ -v /path/on/host/profiles:/var/www/html/profiles \ -v /path/on/host/sites:/var/www/html/sites \ -v /path/on/host/themes:/var/www/html/themes \

Thanks for helping!