docker-library/drupal

Drupal 7 + docker installation: problems with www-data access to volume

vvmspace opened this issue · 3 comments

I have folder "sites"

My docker-compose:

version: '3.1'
services:
  db:
    image: mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=rootpass
      - MYSQL_DATABASE=drupal
      - MYSQL_USER=admin
      - MYSQL_PASSWORD=soomepathword
    expose:
      - "3306"
    volumes:
      - ./mysql:/var/lib/mysql
  web:
    image: drupal:7.69
    volumes: 
      - ./sites:/var/www/html/sites
    ports:
      - "80:80"
    links:
      - db

I have problem in installation process:

The directory sites/default/files  does not exist. An automated attempt to create this directory failed,  possibly due to a permissions problem. To proceed with the installation,  either create the directory and modify its permissions manually or  ensure that the installer has the permissions to create it  automatically. For more information, see INSTALL.txt or the online handbook.

sites/default/files does not exist. An automated attempt to create this directory failed, possibly due to a permissions problem.

Does your ./sites/default/files that your mounting have appropriate permissions?

sites/default/files does not exist. An automated attempt to create this directory failed, possibly due to a permissions problem.

Does your ./sites/default/files that your mounting have appropriate permissions?

That's a right question:

Drupal in Docker is running with www-data (id 33) user. My user has id 1000.

I've found another decision (changed owner of ./sites to 33:33 inside container, and set owner my user for less files), but how to manage permissions correctly? To grant access to www-data and my user without conflicts?

Sorry for the delay -- I think you'd probably be better off trying to run the container as your user than straddling the UID/GID conflicts, but you might be able to just widen the permissions on your directories so that the user "33" inside the container can read them.

In the future (and for further help), these sorts of questions/requests would be more appropriately posted to a dedicated support forum, such as the Docker Community Forums, the Docker Community Slack, or Stack Overflow.