No application encryption key has been specified. #2939

Closed
opened 2026-02-05 05:48:16 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @dd-gamer on GitHub (Aug 8, 2022).

Describe the Bug

I'm trying to setup bookstack in docker, but can't get further than the error "" after loading the webinterface. It's running on top of a Raspberry Pi 4b. This is my docker-compose file:

---
version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    security_opt:
      - seccomp:unconfined
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=http://192.168.0.126:6875
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_PASS=xxx
      - DB_DATABASE=bookstackapp
      - APP_DEBUG=true
    volumes:
      - /home/pi/bookstack:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    security_opt:
      - seccomp:unconfined
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=xxx
      - TZ=Europe/Berlin
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=xxx
    volumes:
      - /home/pi/bookstack:/config
    restart: unless-stopped

After opening the webinterface, I'm welcomed with:
Error
Illuminate\Encryption\MissingAppKeyException
No application encryption key has been specified.

After some googling, I found out that it has something to do with artisan. But when I connect into the container over bash and run 'php artisan', it tells me 'Could not open input file: artisan'.

Does anyone knows a fix for this?

Steps to Reproduce

  1. Load docker-compose on pi4
  2. Go to webinterface

Expected Behaviour

Error
Illuminate\Encryption\MissingAppKeyException
No application encryption key has been specified.

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v22.07.1

PHP Version

7.4.26

Hosting Environment

Docker on pi4b

Originally created by @dd-gamer on GitHub (Aug 8, 2022). ### Describe the Bug I'm trying to setup bookstack in docker, but can't get further than the error "" after loading the webinterface. It's running on top of a Raspberry Pi 4b. This is my docker-compose file: <details> ```yaml --- version: "2" services: bookstack: image: lscr.io/linuxserver/bookstack container_name: bookstack security_opt: - seccomp:unconfined environment: - PUID=1000 - PGID=1000 - APP_URL=http://192.168.0.126:6875 - DB_HOST=bookstack_db - DB_USER=bookstack - DB_PASS=xxx - DB_DATABASE=bookstackapp - APP_DEBUG=true volumes: - /home/pi/bookstack:/config ports: - 6875:80 restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: lscr.io/linuxserver/mariadb container_name: bookstack_db security_opt: - seccomp:unconfined environment: - PUID=1000 - PGID=1000 - MYSQL_ROOT_PASSWORD=xxx - TZ=Europe/Berlin - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=xxx volumes: - /home/pi/bookstack:/config restart: unless-stopped ``` </details> After opening the webinterface, I'm welcomed with: Error Illuminate\Encryption\MissingAppKeyException No application encryption key has been specified. After some googling, I found out that it has something to do with artisan. But when I connect into the container over bash and run 'php artisan', it tells me 'Could not open input file: artisan'. Does anyone knows a fix for this? ### Steps to Reproduce 1. Load docker-compose on pi4 2. Go to webinterface ### Expected Behaviour Error Illuminate\Encryption\MissingAppKeyException No application encryption key has been specified. ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v22.07.1 ### PHP Version 7.4.26 ### Hosting Environment Docker on pi4b
OVERLORD added the 🐛 Bug label 2026-02-05 05:48:16 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Aug 8, 2022):

Hi @dd-gamer,

The app key should be auto-generated during start-up when using the linuxserver container image, so the lack of this may indicate an issue (Perhaps that mentioned below). You can re-generate this key yourself using the command php artisan key:generate from within the /var/www/html directory within container.

Within your provided docker-compose file I noticed you are mapping the volumes for both containers to the same host directory. I'd heavily advise against this, as it might be causing you issues or cause future issues. Map these volumes to two different host directories.

@ssddanbrown commented on GitHub (Aug 8, 2022): Hi @dd-gamer, The app key should be auto-generated during start-up when using the linuxserver container image, so the lack of this may indicate an issue (Perhaps that mentioned below). You can re-generate this key yourself using the command `php artisan key:generate` from within the `/var/www/html` directory within container. Within your provided `docker-compose` file I noticed you are mapping the volumes for both containers to the same host directory. I'd heavily advise against this, as it might be causing you issues or cause future issues. Map these volumes to two different host directories.
Author
Owner

@dd-gamer commented on GitHub (Aug 8, 2022):

That worked, awesome! Is there a way to include this in the docker compose, so I don't need to redo this step if I made a change to the compose file?

@dd-gamer commented on GitHub (Aug 8, 2022): That worked, awesome! Is there a way to include this in the docker compose, so I don't need to redo this step if I made a change to the compose file?
Author
Owner

@ssddanbrown commented on GitHub (Aug 8, 2022):

Awesome, Will therefore close this off.

The key should be persistent. Somewhere within your BookStack mounted volume folder you should find a .env file, which will contain this key value. As long as that exists and is mounted to your container, you should not need to re-run the command.

@ssddanbrown commented on GitHub (Aug 8, 2022): Awesome, Will therefore close this off. The key should be persistent. Somewhere within your BookStack mounted volume folder you should find a `.env` file, which will contain this key value. As long as that exists and is mounted to your container, you should not need to re-run the command.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2939