Skip to content

fix(docker): pre-create /app/data in engine image and add named data volume - #1925

Open
salarkhannn wants to merge 1 commit into
iii-hq:mainfrom
salarkhannn:fix/docker-data-volume
Open

fix(docker): pre-create /app/data in engine image and add named data volume#1925
salarkhannn wants to merge 1 commit into
iii-hq:mainfrom
salarkhannn:fix/docker-data-volume

Conversation

@salarkhannn

@salarkhannn salarkhannn commented Jun 30, 2026

Copy link
Copy Markdown

The engine image runs as UID 65532 (distroless nonroot) but /app is owned by root, so the configuration worker's default ./data/configuration path is unwritable. Pre-create /app/data owned by 65532 via an Alpine build stage so that a named volume mounted there inherits correct ownership.

Also adds an iii_data named volume to both engine/docker-compose.yml and the project init docker template fixture so a fresh iii project init --docker && docker compose up boots without manual edits.

Closes #1883

Summary by CodeRabbit

  • New Features
    • Application data is now persisted via a dedicated named volume mounted at /app/data (including the provided Docker Compose setup and its template fixture).
  • Bug Fixes
    • Improved container reliability by ensuring the image includes a pre-created data directory with the correct non-root ownership during the build.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@salarkhannn is attempting to deploy a commit to the motia Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 71bd7464-e9f1-4d8e-8dfc-cf52fb358058

📥 Commits

Reviewing files that changed from the base of the PR and between bf6648d and f7426ce.

📒 Files selected for processing (3)
  • engine/Dockerfile
  • engine/docker-compose.yml
  • engine/tests/fixtures/templates/docker/docker-compose.yml
🚧 Files skipped from review as they are similar to previous changes (3)
  • engine/tests/fixtures/templates/docker/docker-compose.yml
  • engine/Dockerfile
  • engine/docker-compose.yml

📝 Walkthrough

Walkthrough

The Dockerfile adds an alpine prep stage to create /app/data owned by UID/GID 65532:65532, copied into the distroless final image. Both engine/docker-compose.yml and the fixture template engine/tests/fixtures/templates/docker/docker-compose.yml now mount a named iii_data volume at /app/data and declare it under top-level volumes:.

Changes

Persistent /app/data volume fix

Layer / File(s) Summary
Dockerfile: alpine prep stage for /app/data ownership
engine/Dockerfile
Adds an alpine prep stage that creates /app/data with chown -R 65532:65532, then the distroless final stage copies the directory from prep.
docker-compose: iii_data volume mount and declaration
engine/docker-compose.yml, engine/tests/fixtures/templates/docker/docker-compose.yml
Mounts the iii_data named volume at /app/data in the iii service and declares it under top-level volumes: in both compose files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐇 I dug a home for /app/data,
With chown and volume, hooray, hoorah!
No more permission grumps at play,
The nonroot bunny can hop all day.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main Docker fix by pre-creating /app/data and adding a named data volume.
Description check ✅ Passed Covers the required What and Why clearly; the Notes section is omitted, but the description is still mostly complete.
Linked Issues check ✅ Passed The changes match #1883 by making /app/data writable in the image and adding the iii_data volume in compose and the template.
Out of Scope Changes check ✅ Passed The PR stays focused on the Docker permission fix and related compose/template updates with no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@engine/Dockerfile`:
- Line 1: The prep stage in the Dockerfile uses a mutable Alpine tag, so update
the FROM line for the prep stage to a digest-pinned Alpine image instead of
alpine:3.21. Keep the existing prep stage name unchanged, and ensure the pinned
reference is used wherever the builder stage is defined so builds remain
reproducible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8b6e85e3-dd31-4051-8067-ba6de893756c

📥 Commits

Reviewing files that changed from the base of the PR and between e44f98e and a05d27d.

📒 Files selected for processing (3)
  • engine/Dockerfile
  • engine/docker-compose.yml
  • engine/tests/fixtures/templates/docker/docker-compose.yml

Comment thread engine/Dockerfile Outdated
@@ -1,4 +1,8 @@
FROM alpine:3.21 AS prep

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== engine/Dockerfile =="
cat -n engine/Dockerfile

echo
echo "== other FROM references in engine/ =="
rg -n '^FROM ' engine -g 'Dockerfile*' || true

echo
echo "== any existing digest-pinned base images =="
rg -n '`@sha256`:' engine -g 'Dockerfile*' || true

Repository: iii-hq/iii

Length of output: 1219


Pin the Alpine builder stage to a digest. alpine:3.21 is mutable, so the prep image can drift independently of this commit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@engine/Dockerfile` at line 1, The prep stage in the Dockerfile uses a mutable
Alpine tag, so update the FROM line for the prep stage to a digest-pinned Alpine
image instead of alpine:3.21. Keep the existing prep stage name unchanged, and
ensure the pinned reference is used wherever the builder stage is defined so
builds remain reproducible.

Source: Path instructions

@salarkhannn
salarkhannn force-pushed the fix/docker-data-volume branch from bf6648d to f7426ce Compare June 30, 2026 12:49
…volume

The engine image runs as UID 65532 (distroless nonroot) but /app is
owned by root, so the configuration worker's default ./data/configuration
path is unwritable. Pre-create /app/data owned by 65532 via a multi-stage
build stage so that a named volume mounted there inherits correct
ownership.

Also add an iii_data named volume to both the engine's docker-compose.yml
and the project init template fixture so fresh docker compose up boots
without manual edits.

Closes iii-hq#1883
@salarkhannn
salarkhannn force-pushed the fix/docker-data-volume branch from f7426ce to af3d35a Compare July 16, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker compose up crash-loops on Linux: configuration worker can't create ./data (permission denied)

1 participant