Skip to content

[BUG] Dockerfile volume mount path mismatch with config.json #173

Closed

Description

@groksrc

Bug Description

The Dockerfile creates a volume mount at /app/data but the Basic Memory config.json is configured to look for data in /root/basic-memory, causing a path mismatch that prevents the application from finding its data directory.

Steps To Reproduce

  1. Build the Docker image from the current Dockerfile
  2. Run the container with a volume mount: docker run -v mydata:/app/data basic-memory
  3. Basic Memory will look for data in /root/basic-memory instead of /app/data
  4. Application fails to access persisted data

Expected Behavior

Basic Memory should use the /app/data directory that is defined as a VOLUME in the Dockerfile.

Actual Behavior

Basic Memory looks for data in /root/basic-memory, ignoring the Docker volume mount at /app/data.

Environment

  • Docker version: Various
  • Basic Memory version: Latest
  • Installation method: Docker

Additional Context

The Dockerfile contains:

VOLUME ["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/app/data"]

But the config.json uses:

{
  "default_project_path": "/root/basic-memory"
}

Possible Solution

Either:

  1. Update the Dockerfile to set VOLUME to /root/basic-memory
  2. Update the config.json to use /app/data as the default_project_path
  3. Add an environment variable override for the data path in Docker contexts

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Activity

  1. groksrc commented on Jun 25, 2025

    @groksrc
    MemberAuthor

    @claude take a look at this one and see if you can find the problem and fix it.

  2. claude commented on Jun 25, 2025

    @claude
    Contributor

    Claude finished @groksrc's task —— View job • claude/issue-173-20250625_194717 • Create PR ➔


    Task Completed ✅

    • Examine current Dockerfile and config.json files
    • Understand the root cause of the path mismatch
    • Choose the best solution approach
    • Implement the fix
    • Test the implementation
    • Run linting and type checking
    • Commit changes

    Analysis

    Found the root cause of the issue:

    1. Dockerfile sets: ENV BASIC_MEMORY_HOME=/app/data (line 21)
    2. Configuration system: Uses Path.home() / "basic-memory" which resolves to /root/basic-memory in the container (config.py:48)
    3. The problem: The configuration system doesn't respect the BASIC_MEMORY_HOME environment variable

    Solution Implemented

    Updated the configuration system in src/basic_memory/config.py to:

    • Use BASIC_MEMORY_HOME environment variable when creating the default "main" project path
    • Fall back to Path.home() / "basic-memory" if the environment variable is not set
    • Applied the fix in both the projects field default and the model_post_init method

    Now the container will correctly use /app/data as the default project path when BASIC_MEMORY_HOME=/app/data is set.

    Changes Made

    • Modified BasicMemoryConfig.projects default factory to use os.getenv("BASIC_MEMORY_HOME", Path.home() / "basic-memory")
    • Updated model_post_init method to use the same logic for consistency
    • Committed changes with detailed explanation
  3. added a commit that references this issue on Jun 25, 2025
    74c1f5c
  4. added 2 commits that reference this issue on Oct 15, 2025
    0848009
    c9fcbb0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions