deck9 / input

A privacy-focused, no-code, open-source form builder designed for simplicity and brand consistency.
https://getinput.co
GNU Affero General Public License v3.0
196 stars 30 forks source link

Server Errors when trying to bind mount docker volume #132

Open Strehk opened 9 months ago

Strehk commented 9 months ago

Hey there!

I tried to setup input and I got it working so far. Altough I ran into the same issue raised in #131 today too when trying to add new teammembers, I have a different problem when it comes to docker volumes.

When I create a docker-volume like this ...

services:
  input:
    image: ghcr.io/deck9/input:main
    volumes:
      - /var/www/html/storage
    environment:
      ...

volumes:
  storage:
    driver: local

... I have no issue. However, when I try to bind mount the volume to my persisted/backed-up storage directory, I get weird errors in the logs, no matter what I try with ownership and permissions and creating the folders and database in advance and/or not... Since storing the data within my persisted path would make my backup-life much easier, I decided to raise this issue.

I got sometimes got different errors, but when I try it like this with no preexisting folder-structure or data without any modification like this ...

services:
  input:
    image: ghcr.io/deck9/input:main
    volumes:
      - ${persisted}:/var/www/html/storage
    environment:
      ...

... I first get somewhat successful logs ...

Attaching to input
input  | 
input  |    INFO  Preparing database.  
input  | 
input  |   Creating migration table .......................................... 3ms DONE
input  | 
input  |    INFO  Running migrations.  
input  | 
input  |   2014_10_12_000000_create_users_table .............................. 4ms DONE
[... other migrations ...]
input  |   9999_99_99_999999_set_autoincrement_values ........................ 3ms DONE
input  | 
input  | 2024-02-07 17:46:51,429 INFO supervisord started with pid 10
input  | 2024-02-07 17:46:52,434 INFO spawned: 'artisan-schedule' with pid 11
input  | 2024-02-07 17:46:52,437 INFO spawned: 'nginx' with pid 12
input  | 2024-02-07 17:46:52,439 INFO spawned: 'php-fpm' with pid 13
input  | [07-Feb-2024 17:46:52] NOTICE: fpm is running, pid 13
input  | [07-Feb-2024 17:46:52] NOTICE: ready to handle connections
input  | 
input  |    INFO  No scheduled commands are ready to run.  
input  | 
input  | 2024-02-07 17:46:53,568 INFO success: artisan-schedule entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
input  | 2024-02-07 17:46:53,569 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
input  | 2024-02-07 17:46:53,569 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

... but when I try to access the webpage, I get these errors:

input  | [2024-02-07 17:48:48] production.ERROR: file_put_contents(/var/www/html/storage/framework/sessions/dSNAv8gQ5b4ABecZ8O4P0TcxOWQbpIoZuZPvemD2): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): file_put_contents(/var/www/html/storage/framework/sessions/dSNAv8gQ5b4ABecZ8O4P0TcxOWQbpIoZuZPvemD2): Failed to open stream: No such file or directory at /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:205)
input  | [stacktrace]
input  | #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(254): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
input  | #1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
input  | #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(205): file_put_contents()
input  | #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(90): Illuminate\\Filesystem\\Filesystem->put()
input  | #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Store.php(172): Illuminate\\Session\\FileSessionHandler->write()
input  | #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(238): Illuminate\\Session\\Store->save()
input  | #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(130): Illuminate\\Session\\Middleware\\StartSession->saveSession()
input  | #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
input  | #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle()
input  | #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #10 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
input  | #11 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #12 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
input  | #13 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(798): Illuminate\\Pipeline\\Pipeline->then()
input  | #15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack()
input  | #16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(741): Illuminate\\Routing\\Router->runRoute()
input  | #17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute()
input  | #18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
input  | #19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
input  | #20 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
input  | #22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
input  | #23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
input  | #25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
input  | #26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #27 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
input  | #28 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #29 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
input  | #30 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #31 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
input  | #32 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
input  | #34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #35 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
input  | #36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
input  | #37 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
input  | #38 {main}
input  | "} 
input  | [2024-02-07 17:48:48] 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)
input  | [stacktrace]
input  | #0 /var/www/html/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php(96): Illuminate\\View\\Compilers\\Compiler->__construct()
input  | #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\View\\ViewServiceProvider->Illuminate\\View\\{closure}()
input  | #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
input  | #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(955): Illuminate\\Container\\Container->resolve()
input  | #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
input  | #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(940): Illuminate\\Container\\Container->make()
input  | #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make()
input  | #7 /var/www/html/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php(164): Illuminate\\Container\\Container->offsetGet()
input  | #8 [internal function]: Illuminate\\View\\ViewServiceProvider->Illuminate\\View\\{closure}()
input  | #9 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php(55): call_user_func()
input  | #10 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Factory.php(310): Illuminate\\View\\Engines\\EngineResolver->resolve()
input  | #11 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Factory.php(274): Illuminate\\View\\Factory->getEngineFromPath()
input  | #12 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Factory.php(146): Illuminate\\View\\Factory->viewInstance()
input  | #13 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(87): Illuminate\\View\\Factory->make()
input  | #14 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(723): Illuminate\\Routing\\ResponseFactory->view()
input  | #15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(650): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()
input  | #16 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(556): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()
input  | #17 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(473): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()
input  | #18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(51): Illuminate\\Foundation\\Exceptions\\Handler->render()
input  | #19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(185): Illuminate\\Routing\\Pipeline->handleException()
input  | #20 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #21 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
input  | #22 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
input  | #24 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #25 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(798): Illuminate\\Pipeline\\Pipeline->then()
input  | #26 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack()
input  | #27 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(741): Illuminate\\Routing\\Router->runRoute()
input  | #28 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute()
input  | #29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
input  | #30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
input  | #31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #32 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
input  | #33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
input  | #34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #35 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
input  | #36 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
input  | #37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
input  | #39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
input  | #41 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
input  | #43 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
input  | #45 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
input  | #46 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
input  | #47 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
input  | #48 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
input  | #49 {main}
input  | "}

I understand that this must be related to permissions somehow since it works perfectly in a not bind mounted volume. But still whatever I tried, I got (sometimes slightly different) error messages of missing files...

I hope you can help – apart from this I am really enjoying input! If you need any further Info or if I can help in any way, please let me know.

Thanks and all the best, Tade

PhilReinking commented 9 months ago

Hey @TadeSF, thx for opening this issue.

First, are you running this on Linux or Mac/Windows?

The issue I found is the following, the storage folder inside the image contains a directory structure that needs to exist for the app to work. Usually, the expected behavior would be that on first mount, the volume is populated with the container contents. This is what happens if you are using named volumes, for example.

Since on Mac / Windows Docker is running inside a Virtual Machine, there might be problems with this behavior? I also just tested it on MacOS.

If you are indeed on a Linux machine, I will further test this.

The best solution right now would be to use a named volume and then backup this named volume?

Cretezy commented 8 months ago

I too am getting this, on Linux. Using named volumes is not an option for me, as I require all data to be stored in a local directory for my Docker containers (I am using a server where the Docker volumes may be cleared).

It seems that the mounted directory is not being populated.

The error on request:

work/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#48 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#49 {main}
"} 
10.0.0.66 - - [09/Mar/2024:04:38:26 +0000] "GET / HTTP/1.1" 500 1027 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0" "-" 0.025 0.025 . -

   INFO  No scheduled commands are ready to run.  
anarion80 commented 6 months ago

Hello. Is there any update on this? This is really needed in certain docker deployments.

PhilReinking commented 5 months ago

@anarion80 no solution yet. The problem is that the application is unable to create the folder structure in the volume. If you guys have to suggestions on how to tackle this, I appreciate it.

I thought about adding a script for the case where you can not use named volumes, that runs on startup and creates the folder structure inside the mounted path. But not sure if this is the right way to go.

Strehk commented 5 months ago

Hey @PhilReinking! You already have a start-container.sh script that starts the container – is it not possible to just make adaptions to it similar to the following? After my (admittedly not very extensive) research, I would say its best practice.

#!/usr/bin/env sh

# Create necessary directories and set permissions
mkdir -p /var/www/html/storage/framework/sessions
mkdir -p /var/www/html/storage/framework/cache
mkdir -p /var/www/html/storage/framework/views
chown -R nobody:nobody /var/www/html/storage

# Migrate the database
/usr/bin/php /var/www/html/artisan migrate --force

# Start Supervisor
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf

# Execute the main command passed to docker run (this is what "exec "$@" does)
exec "$@"

The script inside the container should have all necessary execution rights thanks to these lines already in the Docker-Compose:

COPY --chown=nobody:nobody ./start-container.sh /opt/input/start-container.sh
RUN chmod +x /opt/input/start-container.sh
USER nobody
ENTRYPOINT ["/opt/input/start-container.sh"]

And if I understand Docker correctly, Docker should create the files on the mounted volume with ownership of the configured Docker-User (e.g. www-data or smth similar)

Btw. sorry for being so unresponsive after submitting the issue – i lost track of it and just now stumbled over the notification 😅