linuxserver/docker-bookstack

[BUG] Failure installation with SQLSTATE[HY000] [2002] No such file or directory

bjlin888 opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I only run doker cli to startup bookstack, but it don't work.

Expected Behavior

No response

Steps To Reproduce

docker run -d
--name=bookstack
-e PUID=1000
-e PGID=1000
-e TZ=Asia/Taipei
-e APP_URL=http://localhost/mybookstack
-e APP_KEY=MY_APP_KEY
-e DB_HOST=localhost
-e DB_PORT=3306
-e DB_USERNAME=root
-e DB_PASSWORD=password
-e DB_DATABASE=bookstack
-p 9002:80
-v /bookstack/config:/config
--restart unless-stopped
lscr.io/linuxserver/bookstack:latest

Environment

MySql 8.3
Run on Macbook Pro Intel base

CPU architecture

x86-64

Docker creation

docker run -d \
  --name=bookstack \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Taipei \
  -e APP_URL=http://localhost/mybookstack \
  -e APP_KEY=MY_APP_KEY \
  -e DB_HOST=localhost \
  -e DB_PORT=3306 \
  -e DB_USERNAME=root \
  -e DB_PASSWORD=password \
  -e DB_DATABASE=bookstack \
  -p 9002:80 \
  -v /bookstack/config:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/bookstack:latest

Container logs

[laravel.log](https://github.com/user-attachments/files/18823645/laravel.log)

> 2025-02-17 17:46:09   SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'bookstack' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)
2025-02-17 17:46:09 
2025-02-17 17:46:09   at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
2025-02-17 17:46:09     825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
2025-02-17 17:46:09     826▕                 );
2025-02-17 17:46:09     827▕             }
2025-02-17 17:46:09     828▕ 
2025-02-17 17:46:09   ➜ 829▕             throw new QueryException(
2025-02-17 17:46:09     830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
2025-02-17 17:46:09     831▕             );
2025-02-17 17:46:09     832▕         }
2025-02-17 17:46:09     833▕     }
2025-02-17 17:46:09 
2025-02-17 17:46:09       +39 vendor frames 
2025-02-17 17:46:09 
2025-02-17 17:46:09   40  /app/www/artisan:35
2025-02-17 17:46:09       Illuminate\Foundation\Console\Kernel::handle()
2025-02-17 17:46:09 
2025-02-17 17:46:09 [custom-init] No custom files found, skipping...

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

Localhost does not work in containers like you'd expect it to, you need to use the host ip (or if running in a container, join it to the same network and use the containername.)

Thanks, I have solved it.