No valid cache path after first start using Docker

Hi Community,

I’m installing InvoiceNinja using Docker by following the instructions from the Dockerfile repository on GitHub: GitHub - invoiceninja/dockerfiles: Docker files for Invoice Ninja. However, I’m encountering an error in the app container after starting it for the first time:

In Compiler.php line 67:
                                      
  Please provide a valid cache path. 

Does anyone have an idea why this might be happening and how to resolve it?

Thanks!

Version

v5.10.30 / I used the the invoiceninja/invoiceninja-debian:latest image

Environment

Docker

Logs

2025-01-28 10:47:25] production.ERROR: Please provide a valid cache path. {"exception":"[object] (InvalidArgumentException(code: 0): Please provide a valid cache path. at /var/www/html/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:67)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php(97): Illuminate\\View\\Compilers\\Compiler->__construct()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(937): Illuminate\\View\\ViewServiceProvider->Illuminate\\View\\{closure}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(819): Illuminate\\Container\\Container->build()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1051): Illuminate\\Container\\Container->resolve()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(755): Illuminate\\Foundation\\Application->resolve()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1033): Illuminate\\Container\\Container->make()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1565): Illuminate\\Foundation\\Application->make()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(239): Illuminate\\Container\\Container->offsetGet()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(210): Illuminate\\Support\\Facades\\Facade::resolveFacadeInstance()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#10 /var/www/html/vendor/livewire/livewire/src/Mechanisms/FrontendAssets/FrontendAssets.php(30): Illuminate\\Support\\Facades\\Facade::__callStatic()
#11 /var/www/html/vendor/livewire/livewire/src/LivewireServiceProvider.php(77): Livewire\\Mechanisms\\FrontendAssets\\FrontendAssets->boot()
#12 /var/www/html/vendor/livewire/livewire/src/LivewireServiceProvider.php(19): Livewire\\LivewireServiceProvider->bootMechanisms()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Livewire\\LivewireServiceProvider->boot()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\\Container\\BoundMethod::call()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1124): Illuminate\\Container\\Container->call()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1105): Illuminate\\Foundation\\Application->bootProvider()
#20 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1104): array_walk()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(319): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(474): Illuminate\\Foundation\\Application->bootstrapWith()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#26 /var/www/html/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#27 {main}
"}```

Hi,

This may help:

Hi @hillel,

thanks for reaching out, this fix it!

1 Like

Hi @redberry94 ! Could you by chance please tell me how you fixed this issue? I am getting the same error and I have tried creating these folders inside of the docker app_cache volume but it is not working for me. :frowning: Any help would be much appreciated!

Mike

Hi @T3CH,

I tried to bind mount the cache directory, but this failed with the mentioned error. Instead, I created a Docker volume for the cache directory since I don’t need to back up cache directories.

My full Compose template for the app service looks like this:

app:
    build:
      context: .
    image: invoiceninja/invoiceninja-debian:latest
    container_name: erp-app
    restart: unless-stopped
    env_file:
      - ./.env
    volumes:
      - ./.env:/var/www/html/.env
      - ./app-data/public:/var/www/html/public
      - ./app-data/storage:/var/www/html/storage
      - erp-cache:/var/www/html/bootstrap/cache
    networks:
      - erp-network
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_healthy
    logging: *default-logging

The service starts as expected and I can back up the relevant data from the file system from the ./app-data/public and ./app-data/storage directories.

Best,
Florian

1 Like

Well bummer… thank you very much for responding! I can’t seem to get this going though… I’m still getting an error of the following:
app-1 | Public Folder is up to date
app-1 |
app-1 | In Compiler.php line 67:
app-1 |
app-1 | Please provide a valid cache path.
app-1 |
app-1 |
app-1 exited with code 1

My docker file looks like this:

x-logging: &default-logging
  options:
    max-size: "10m"
    max-file: "3"
  driver: json-file

services:
  app:
    build:
      context: .
    image: invoiceninja/invoiceninja-debian:${TAG:-latest}
    restart: unless-stopped
    env_file:
      - ./.env
    environment:
      PUID: 1500
    volumes:
      - ./.env:/var/www/html/.env
      # - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
      # - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
      # - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
#      - ./ninja-data/app_cache:/var/www/html/bootstrap/cache
      - ./ninja-data/app_public:/var/www/html/public
      - ./ninja-data/app_storage:/var/www/html/storage
      - app_cache:/var/www/html/bootstrap/cache
#      - app_public:/var/www/html/public
#      - app_storage:/var/www/html/storage
    networks:
      - ninja-network
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_healthy
    logging: *default-logging

  nginx:
    image: nginx:alpine
    restart: unless-stopped
#    ports:
#      - "80:80"
    environment:
      PUID: 1500
    volumes:
      - ./ninja-data/nginx:/etc/nginx/conf.d:ro
      - ./ninja-data/app_public:/var/www/html/public:ro
      - ./ninja-data/app_storage:/var/www/html/storage:ro
#      - ./nginx:/etc/nginx/conf.d:ro
#      - app_public:/var/www/html/public:ro
#      - app_storage:/var/www/html/storage:ro
    networks:
      - ninja-network
    depends_on:
      - app
    logging: *default-logging

  mysql:
    image: mysql:8
    restart: unless-stopped
    env_file:
      - ./.env
    environment:
      PUID: 1500
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
    volumes:
      - ./ninja-data/mysql_data:/var/lib/mysql
#      - mysql_data:/var/lib/mysql
    networks:
      - ninja-network
    healthcheck:
      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}" ]
      interval: 10s
      timeout: 5s
      retries: 5
    logging: *default-logging

  redis:
    image: redis:alpine
    restart: unless-stopped
    volumes:
#      - ./ninja-data/redis_data:/data
      - redis_data:/data
    networks:
      - ninja-network
    healthcheck:
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 10s
      timeout: 5s
      retries: 5
    logging: *default-logging

networks:
  ninja-network:
    driver: bridge

volumes:
  app_cache:
    driver: local
#  app_public:
#    driver: local
#  app_storage:
#    driver: local
#  mysql_data:
#    driver: local
  redis_data:
    driver: local

I’m running docker rootless so not sure if something is going on there… I figured setting the cache to a docker volume would solve permissions issues but it doesn’t seem to. I even put in the PUID of 1500 to force it but that doesn’t seem to do anything either… I’m at a loss!