[GH-ISSUE #640] [Issue]: Docker failing to create .env on a fresh run #299

Closed
opened 2026-10-20 17:27:24 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Talref on GitHub (May 10, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/640

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The Docker image treats /app as non-writable, but Marinara Engine still attempts to create and persist runtime configuration in /app/.env.

This causes permission errors with the official Docker Compose configuration and makes some runtime configuration features (such as IP_ALLOWLIST) unusable unless /app/.env is manually bind-mounted from the host.

There also appears to be inconsistent handling of DATA_DIR, where some storage paths still resolve inside the image filesystem instead of the configured writable data directory.

Expected behavior

  • The official Docker Compose configuration should work without requiring additional bind mounts.

  • Runtime configuration should either:

    • use environment variables only, or
    • persist under /app/data (or another writable mounted path).
  • The application should not attempt to write inside the immutable image filesystem.

  • DATA_DIR=/app/data should consistently affect all storage paths.

Actual behavior

With the official compose file:

volumes:
  - marinara-data:/app/data

the container logs:

[runtime-config] Could not auto-create .env file; continuing without it
EACCES: permission denied, open '/app/.env'

The app continues running, but runtime config features depending on /app/.env do not work correctly unless /app/.env is manually mounted from the host.

Additionally, when using bind-mounted storage (./data:/app/data), the application attempts to create:

/app/packages/server/data/storage

instead of using the configured DATA_DIR.

This results in:

EACCES: permission denied, mkdir '/app/packages/server/data/storage'

and the container enters a restart loop.

Steps to reproduce

  1. Use the official Docker Compose example from the README.
  2. Start the container with:
docker compose up
  1. Observe:
EACCES: permission denied, open '/app/.env'
  1. Attempt to configure runtime settings such as:
IP_ALLOWLIST=192.168.1.0/24
  1. Observe that /app/.env must be writable/mounted for these settings to persist/work correctly.

Additional reproduction for the storage issue:

  1. Replace the named volume with:
- ./data:/app/data
  1. Start the container.
  2. Observe the app attempts to write to:
/app/packages/server/data/storage

instead of /app/data/storage.

Environment

  • Marinara Engine version: latest GHCR image at time of reporting
  • Install type: docker
  • OS + version: Arch Linux
  • Browser or app shell: Firefox / Chromium

Logs, screenshots, or video

.env permission issue:

[runtime-config] Could not auto-create .env file; continuing without it

Error: EACCES: permission denied, open '/app/.env'

Storage path issue:

[storage] DATA_DIR=/app/data
[storage] FILE_STORAGE_DIR=/app/packages/server/data/storage

followed by:

Error: EACCES: permission denied, mkdir '/app/packages/server/data/storage'

Additional context

Current workaround:

volumes:
  - marinara-data:/app/data
  - ./.env:/app/.env

with:

touch .env

before startup.

This allows runtime-config persistence to function correctly.

It may make sense to:

  • move runtime config persistence into /app/data
  • avoid auto-writing /app/.env in containerized environments
  • ensure all storage paths derive consistently from DATA_DIR

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Talref on GitHub (May 10, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/640 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The Docker image treats `/app` as non-writable, but Marinara Engine still attempts to create and persist runtime configuration in `/app/.env`. This causes permission errors with the official Docker Compose configuration and makes some runtime configuration features (such as `IP_ALLOWLIST`) unusable unless `/app/.env` is manually bind-mounted from the host. There also appears to be inconsistent handling of `DATA_DIR`, where some storage paths still resolve inside the image filesystem instead of the configured writable data directory. ## Expected behavior * The official Docker Compose configuration should work without requiring additional bind mounts. * Runtime configuration should either: * use environment variables only, or * persist under `/app/data` (or another writable mounted path). * The application should not attempt to write inside the immutable image filesystem. * `DATA_DIR=/app/data` should consistently affect all storage paths. ## Actual behavior With the official compose file: ```yaml volumes: - marinara-data:/app/data ``` the container logs: ```text [runtime-config] Could not auto-create .env file; continuing without it EACCES: permission denied, open '/app/.env' ``` The app continues running, but runtime config features depending on `/app/.env` do not work correctly unless `/app/.env` is manually mounted from the host. Additionally, when using bind-mounted storage (`./data:/app/data`), the application attempts to create: ```text /app/packages/server/data/storage ``` instead of using the configured `DATA_DIR`. This results in: ```text EACCES: permission denied, mkdir '/app/packages/server/data/storage' ``` and the container enters a restart loop. ## Steps to reproduce 1. Use the official Docker Compose example from the README. 2. Start the container with: ```bash docker compose up ``` 3. Observe: ```text EACCES: permission denied, open '/app/.env' ``` 4. Attempt to configure runtime settings such as: ```text IP_ALLOWLIST=192.168.1.0/24 ``` 5. Observe that `/app/.env` must be writable/mounted for these settings to persist/work correctly. Additional reproduction for the storage issue: 1. Replace the named volume with: ```yaml - ./data:/app/data ``` 2. Start the container. 3. Observe the app attempts to write to: ```text /app/packages/server/data/storage ``` instead of `/app/data/storage`. ## Environment * Marinara Engine version: latest GHCR image at time of reporting * Install type: docker * OS + version: Arch Linux * Browser or app shell: Firefox / Chromium ## Logs, screenshots, or video `.env` permission issue: ```text [runtime-config] Could not auto-create .env file; continuing without it Error: EACCES: permission denied, open '/app/.env' ``` Storage path issue: ```text [storage] DATA_DIR=/app/data [storage] FILE_STORAGE_DIR=/app/packages/server/data/storage ``` followed by: ```text Error: EACCES: permission denied, mkdir '/app/packages/server/data/storage' ``` ## Additional context Current workaround: ```yaml volumes: - marinara-data:/app/data - ./.env:/app/.env ``` with: ```bash touch .env ``` before startup. This allows runtime-config persistence to function correctly. It may make sense to: * move runtime config persistence into `/app/data` * avoid auto-writing `/app/.env` in containerized environments * ensure all storage paths derive consistently from `DATA_DIR` ## Template check * [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:27:24 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (May 10, 2026):

Fixed on main in commit 8d16c06.

What changed:

  • Official Docker/Lite Docker images now set FILE_STORAGE_DIR=/app/data/storage and mark the runtime as Docker explicitly.
  • Runtime .env auto-creation now targets the persistent Docker data volume at /app/data/.env by default, while preserving explicit MARINARA_ENV_FILE overrides and legacy /app/.env mounts.
  • Container docs now call out the persistent .env and storage paths.

Validation run:

  • pnpm exec prettier --write ...
  • pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/sidecar-runtime-selection.test.ts
  • pnpm impeccable:check
  • pnpm lint
  • pnpm build
<!-- gh-comment-id:4415663262 --> @SpicyMarinara commented on GitHub (May 10, 2026): Fixed on `main` in commit `8d16c06`. What changed: - Official Docker/Lite Docker images now set `FILE_STORAGE_DIR=/app/data/storage` and mark the runtime as Docker explicitly. - Runtime `.env` auto-creation now targets the persistent Docker data volume at `/app/data/.env` by default, while preserving explicit `MARINARA_ENV_FILE` overrides and legacy `/app/.env` mounts. - Container docs now call out the persistent `.env` and storage paths. Validation run: - `pnpm exec prettier --write ...` - `pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/sidecar-runtime-selection.test.ts` - `pnpm impeccable:check` - `pnpm lint` - `pnpm build`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#299
No description provided.