LINUX.ORG.RU

Bookstack Docker Compose

 , ,


0

1

Docker desktop установлен на Windows 10. Устанавливаю образы с контейнерами с помощью docker compose. Подскажите где мне посмотреть PUID и PGID для пользователя admin?

Для управления контейнерами использую Portainer.io.

Ниже привожу инструкцию docker compose.

---
version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=localhost
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=bookstack
      - DB_DATABASE=bookstackapp
    volumes:
      - /home/docker/bookstack/config:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=bookstackroot
      - TZ=Europe/Moscow
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=bookstack
    volumes:
      - /home/docker/bookstack/config:/config
    restart: unless-stopped


Последнее исправление: lukman (всего исправлений: 1)

Ответ на: комментарий от lukman

Сильно подозреваю, что ты ошибаешься, но ещё не понял этого

docker в принципе работает только на ядре linux. в windows docker desktop скорее всего будет использовать wsl. И ему будет глубоко параллельно на твоего windows пользователя.

router ★★★★★
()
Последнее исправление: router (всего исправлений: 2)
Ответ на: комментарий от router

Ты верно понял! Docker-desktop это хост с линуксом.

Как я понимаю — мне нужно в инструкцию docker-compose подсунуть параметры пользователя admin из хоста docker-desktop

В качестве бакэнда для Docker стоит WSL 2.

lukman
() автор топика

Лог контейнере bookstack_db

[migrations] started
[migrations] no migrations found
-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid:    1000
User gid:    1000
-------------------------------------
Setting Up Initial Databases
Installing MariaDB/MySQL system tables in '/config/databases' ...
2023-01-30 11:43:17 0 [ERROR] mariadbd: File '/config/databases/aria_log_control' not found (Errcode: 13 "Permission denied")
2023-01-30 11:43:17 0 [ERROR] mariadbd: Got error 'Can't open file' when trying to use aria control file '/config/databases/aria_log_control'
2023-01-30 11:43:17 0 [ERROR] Plugin 'Aria' init function returned error.
2023-01-30 11:43:17 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2023-01-30 11:43:17 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2023-01-30 11:43:17 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2023-01-30 11:43:17 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-30 11:43:17 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-30 11:43:17 0 [ERROR] Failed to initialize plugins.
2023-01-30 11:43:17 0 [ERROR] Aborting
Installation of system tables failed!  Examine the logs in
/config/databases for more information.
The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:
    shell> /usr/bin/mariadb-install-db --defaults-file=~/.my.cnf
You can also try to start the mysqld daemon with:
    shell> /usr/bin/mariadbd --skip-grant-tables --general-log &
and use the command line tool /usr/bin/mariadb
to connect to the mysql database and look at the grant tables:
    shell> /usr/bin/mysql -u root mysql
    mysql> show tables;
Try 'mysqld --help' if you have problems with paths.  Using
--general-log gives you a log in /config/databases that may be helpful.
The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
You can find the latest source at https://downloads.mariadb.org and
the maria-discuss email list at https://launchpad.net/~maria-discuss
Please check all of the above before submitting a bug report
at https://mariadb.org/jira
2023-01-30 11:43:17 0 [Note] mariadbd (server 10.6.10-MariaDB-log) starting as process 142 ...
2023-01-30 11:43:17 0 [ERROR] mariadbd: File '/config/databases/aria_log_control' not found (Errcode: 13 "Permission denied")
2023-01-30 11:43:17 0 [ERROR] mariadbd: Got error 'Can't open file' when trying to use aria control file '/config/databases/aria_log_control'
2023-01-30 11:43:17 0 [ERROR] Plugin 'Aria' init function returned error.
2023-01-30 11:43:17 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2023-01-30 11:43:17 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2023-01-30 11:43:17 0 [ERROR] InnoDB: The data file './ibdata1' must be writable
2023-01-30 11:43:17 0 [ERROR] Plugin 'InnoDB' init function returned error.
2023-01-30 11:43:17 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-01-30 11:43:17 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-01-30 11:43:17 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
2023-01-30 11:43:17 0 [ERROR] Failed to initialize plugins.
2023-01-30 11:43:17 0 [ERROR] Aborting
lukman
() автор топика
Последнее исправление: lukman (всего исправлений: 2)

Лог контейнера bookstack

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid:    1000
User gid:    1000
-------------------------------------
using keys found in /config/keys
App Key found - setting variable for seds
Running config - DB_HOST set
Waiting for DB to be available
   Illuminate\Database\QueryException 
  SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE')
  at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }
      +36 vendor frames 
  37  /app/www/artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
[custom-init] No custom files found, skipping...
[ls.io-init] done.
lukman
() автор топика
Последнее исправление: lukman (всего исправлений: 2)
Ответ на: комментарий от lukman

Как я понимаю — мне нужно в инструкцию docker-compose подсунуть параметры пользователя admin из хоста docker-desktop

Нет, подсовывать реального пользователя не обязательно, в контейнере может быть свой. Влиять будет только на доступ к volumes

2023-01-30 11:43:17 0 [ERROR] mariadbd: Got error ‘Can’t open file’ when trying to use aria control file ‘/config/databases/aria_log_control’

/home/docker/bookstack/config:/config

Вот к этому, например. Можно тупо выдать 1777, и запускать контейнер от любого рандомного uid и gid. Добавлять на хост-систему учётку не потребуется

Либо указать реальтые uid и gid, и дать доступ к каталогу конкретно этой учётке

router ★★★★★
()
Ответ на: комментарий от router

Вот к этому, например. Можно тупо выдать 1777, и запускать контейнер от любого рандомного uid и gid. Добавлять на хост-систему учётку не потребуется

Либо указать реальтые uid и gid, и дать доступ к каталогу конкретно этой учётке

Пробовал указывать рандомные значения в docker-compose. Не получилось. Не понимаю где узнать uid и gid для конкретного пользователя…

Вот моя конфигурация:

  • Docker в WSL 2;
    • portainer;
    • bockstack - контейнер для bookstack;
    • bookstack_db - контейнер mariadb для bookstack;

Ну и на github рекомендации как установить Bookstack в Docker. https://github.com/linuxserver/docker-bookstack

lukman
() автор топика

User / Group Identifiers

When using volumes (-v flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance PUID=1000 and PGID=1000, to find yours use id user as below:

$ id username
    uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)

Мне не понятно где в docker узнать эти значения? В WSL только root пользователь.

PS C:\> wsl
PC1:/tmp/docker-desktop-root/mnt/host/c# id
uid=0(root) gid=0(root) groups=0(root),0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
lukman
() автор топика