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

Folders not writable

Open ghost opened this issue 7 years ago • 2 comments

My host is Centos 7 and docker version 17.12.0-ce. I run docker like this:

docker run --name xxx --link mariadb:mysql --restart=always -v folderTest/:/var/www/html:Z -e JOOMLA_DB_USER=xxx -e JOOMLA_DB_PASSWORD=xxxx -e JOOMLA_DB_NAME=xxx -p 3001:80 -d joomla

Then i run in my host folder joomla permissions:

sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;

After that i cannot install or update anything and my system folder permission in joomla are all not writable. Help

ghost avatar Apr 06 '18 11:04 ghost

Are they owned by www-data?

J0WI avatar Jan 11 '19 14:01 J0WI

I have the same problem and I can’t figure out how to solve it All files in the /var/www/html owned by root and the chown www-data:www-data -R /var/www/html does not change the situation

For running container i use docker-compose, with next config:

version: '3'
services:
    joomla:
        image: joomla
        restart: always
        ports:
            - 80:80
            - 443:443
        environment:
            JOOMLA_DB_HOST: mysql
            JOOMLA_DB_PASSWORD: local
            JOOMLA_DB_USER: local
            JOOMLA_DB_NAME: local
        volumes:
            - ./html:/var/www/html
        depends_on:
            - mysql
    mysql:
        image: "mysql:5.7"
        volumes:
            - ./mysql:/var/lib/mysql
        environment:
               MYSQL_ROOT_PASSWORD: root
               MYSQL_DATABASE: local
               MYSQL_USER: local
               MYSQL_PASSWORD: local
        ports:
            - "3306:3306"

My OS is Windows 10 Pro Docker version 19.03.8, build afacb8b docker-compose version 1.25.4, build 8d51620a

kernusr avatar Mar 21 '20 14:03 kernusr

I know this is years to late.... but this is now resolved as you can start the container with the correct ownership of this files and so be able to edit the files without any trouble.

version: '2'
services:
  mariadb_test:
    image: mariadb:latest
    container_name: mariadb_test
    restart: unless-stopped
    environment:
      - MARIADB_DATABASE=${VDM_TEST_DB}
      - MARIADB_USER=${VDM_TEST_DB_USER}
      - MARIADB_PASSWORD=${VDM_TEST_DB_PASS}
      - MARIADB_ROOT_PASSWORD=${VDM_TEST_DB_ROOT}
    volumes:
      - "${VDM_PROJECT_PATH}/test/db:/var/lib/mysql"
    networks:
      - traefik
  joomla_test:
    image: joomla:4
    container_name: joomla_test
    restart: unless-stopped
    environment:
      - APACHE_RUN_USER=#1000
      - APACHE_RUN_GROUP=#1000
      - JOOMLA_DB_HOST=mariadb_test:3306
      - JOOMLA_DB_NAME=${VDM_TEST_DB}
      - JOOMLA_DB_USER=${VDM_TEST_DB_USER}
      - JOOMLA_DB_PASSWORD=${VDM_TEST_DB_PASS}

So the ENV keys you will like to use are:

- APACHE_RUN_USER=#1000
- APACHE_RUN_GROUP=#1000

Remember the # as this is how Apache wants the values, we then in turn update the ownership of the /var/www/html folder with that ID and GROUPID.

This must correspond to the ID of the user where the folder is mounted and will be editing the files.

Llewellynvdm avatar Sep 10 '22 14:09 Llewellynvdm