chevereto / docker

Template project for deploying Chevereto V4 based applications using Docker
https://v4-docs.chevereto.com/guides/docker/
MIT License
55 stars 16 forks source link

Permission errors for /var/www/html/images/_assets/ #58

Closed l4rm4nd closed 8 months ago

l4rm4nd commented 8 months ago

Using the Chevereto Docker image and bind mounts leads to permission errors.

image

Here my compose file:

version: "3.7"

services:
  chevereto:
    image: ghcr.io/chevereto/chevereto:latest
    container_name: chevereto
    init: true
    restart: unless-stopped
    volumes:
      - ./chevereto/images:/var/www/html/images
    ports:
      - 8999:80
    environment:
      CHEVERETO_DB_HOST: mariadb
      CHEVERETO_DB_USER: chevereto
      CHEVERETO_DB_PASS: chevereto
      CHEVERETO_DB_PORT: 3306
      CHEVERETO_DB_NAME: chevereto
      CHEVERETO_ASSET_STORAGE_TYPE: local
      CHEVERETO_ASSET_STORAGE_URL: /images/_assets
      CHEVERETO_ASSET_STORAGE_BUCKET: /var/www/html/images/_assets
      # only enable the next env if chevereto is run begind a reverse proxy
      # adjust to the corresponding http header of your reverse proxy, where a user's real IP is propagated
      # see https://github.com/chevereto/chevereto/issues/44
      #CHEVERETO_HEADER_CLIENT_IP: X-Forwarded-For 

  mariadb:
    image: mariadb
    container_name: chevereto_mariadb
    restart: unless-stopped
    init: true
    environment:
      MYSQL_DATABASE: chevereto
      MYSQL_USER: chevereto
      MYSQL_PASSWORD: chevereto
      MARIADB_ROOT_PASSWORD: chevereto
    volumes:
      - ./chevereto/mariadb:/var/lib/mysql

Even after doing the following commands on the bind mounts and restarting the container, the permission issues remain:

sudo chown -R 33:33 chevereto/*
sudo chmod -R 777 chevereto/*

The issue is only fixed when manually spawning a shell into the container and doing:

# docker exec -it <chevereto-container-name> bash
mkdir -p /var/www/html/images/_assets
chown -R www-data:www-data /var/www/html/images/_assets
chmod -R 777 /var/www/html/images/_assets

Although the Dockerfile defines to adjust the permissions to www-data ....

Line 83  |  RUN chown www-data: . -R && ls -la

.... it somehow seems to fail. Maybe needs troubleshooting.