Docker - permission denied

Hi all,
I’m trying to install the official docker of InvoiceNinja. but I’m stuck!
the app container’s log report:

cp: can't create directory '/var/www/app/storage/app': Permission denied

even if I absurdly change the folder permission to 777 I keep getting that error. I’ve chowned to www-data, no better.
What’s wrong?
Thanks!

Hi,

Have you made any changes to the docker file?

@david do you have any ideas?

Hi Hillel,
I’ve changed: paths, containers name and network:

version: '3.7'

services:
  server:
    image: nginx
    container_name: invoiceninja_nginx
    restart: always
    env_file: env
    volumes:
      # Vhost configuration
      #- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
      - /var/docker/invoiceninja/config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
      - /var/docker/invoiceninja/app/public:/var/www/app/public:ro
    depends_on:
      - app
    # Run webserver nginx on port 80
    # Feel free to modify depending what port is already occupied
    ports:
      - "127.0.0.1:82:80"
      #- "443:443"
    networks:
      internal_bridge:
        ipv4_address: "172.20.0.7"
    extra_hosts:
      - "invoiceninja.mydomain.com:172.20.0.7 " #host and ip

  app:
    image: invoiceninja/invoiceninja:5
    container_name: invoiceninja_app
    env_file: env
    restart: always
    volumes:
      - /var/docker/invoiceninja/config/hosts:/etc/hosts:ro
      - /var/docker/invoiceninja/app/public:/var/www/app/public:rw,delegated
      - /var/docker/invoiceninja/app/storage:/var/www/app/storage:rw,delegated
    depends_on:
      - db
    networks:
      internal_bridge:
        ipv4_address: "172.20.0.8"
    extra_hosts:
      - "invoiceninja.mydomain.com:172.20.0.7 " #host and ip

  db:
    image: mysql:5
    container_name: invoiceninja_mysql
#    When running on ARM64 use MariaDB instead of MySQL
#    image: mariadb:10.4
#    For auto DB backups comment out image and use the build block below
#    build:
#      context: ./config/mysql
    ports:
         - "127.0.0.1:3305:3306"
    restart: always
    env_file: env
    volumes:
      - /var/docker/invoiceninja/mysql/data:/var/lib/mysql:rw,delegated

      # remove comments for next 4 lines if you want auto sql backups
      #- ./docker/mysql/bak:/backups:rw
      #- ./config/mysql/backup-script:/etc/cron.daily/daily:ro
      #- ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro
      #- ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro
    networks:
      internal_bridge:
        ipv4_address: "172.20.0.9"
    extra_hosts:
      - "invoiceninja.mydomain.com:172.20.0.7 " #host and ip

  # THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
  # cron:
  #   image: invoiceninja/invoiceninja:alpine-4
  #   volumes:
      # - ./docker/app/public:/var/www/app/public:rw,delegated
      # - ./docker/app/storage:/var/www/app/storage:rw,delegated
      # - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated
  #   entrypoint: |
  #     /bin/sh -c 'sh -s <<EOF
  #     trap "break;exit" SIGHUP SIGINT SIGTERM
  #     sleep 300s
  #     while /bin/true; do
  #       ./artisan ninja:send-invoices
  #       ./artisan ninja:send-reminders
  #       sleep 1d
  #     done
  #     EOF'
  #   networks:
  #     - invoiceninja
  #

networks:
  internal_bridge:
    external: true

I don’t believe you should need to make any changes to the docker file?

But I’m behind Nginx reverse proxy, so I need to edit the network and I need to move the storage to a different drive

Maybe this will help:

I’ve tried with chown -R 1000:82 app, but since chmod 777 didn’t work, neither did this :frowning:
I’ve tried using the docker-compose as is, but I still get the same permission denied error.
An extra info: I get the error

ERROR: for invoiceninja5_original_app_1 Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/andrea/docker-compose/invoiceninja5_original/config/hosts" to rootfs at "/etc/hosts": mount /home/andrea/docker-compose/invoiceninja5_original/config/hosts:/etc/hosts (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

I’ve always got it but I worked around creating the hosts file manually

Sorry, I’m not sure. You may want to create an issue on the dockerfile GitHub repo.

Will do!
…filling chars…

I’ve solved it following this posts: Cannot use named volumes for `/var/www/app/public` - invoiceninja/dockerfiles

Glad to hear it, thanks for sharing the solution!

Now I’m stuck with a problem with nginx :sob: I’ll open a new post