@@ -15,7 +15,7 @@ Basic Memory provides pre-built Docker images on GitHub Container Registry that
1515 --name basic-memory-server \
1616 -p 8000:8000 \
1717 -v /path/to/your/obsidian-vault:/app/data:rw \
18- -v basic-memory-config:/root /.basic-memory:rw \
18+ -v basic-memory-config:/app /.basic-memory:rw \
1919 ghcr.io/basicmachines-co/basic-memory:latest
2020 ```
2121
@@ -30,7 +30,7 @@ Basic Memory provides pre-built Docker images on GitHub Container Registry that
3030 - " 8000:8000"
3131 volumes :
3232 - /path/to/your/obsidian-vault:/app/data:rw
33- - basic-memory-config:/root /.basic-memory:rw
33+ - basic-memory-config:/app /.basic-memory:rw
3434 environment :
3535 - BASIC_MEMORY_DEFAULT_PROJECT=main
3636 restart : unless-stopped
@@ -67,7 +67,7 @@ docker build -t basic-memory .
6767docker run -d \
6868 --name basic-memory-server \
6969 -v /path/to/your/obsidian-vault:/app/data:rw \
70- -v basic-memory-config:/root /.basic-memory:rw \
70+ -v basic-memory-config:/app /.basic-memory:rw \
7171 -e BASIC_MEMORY_DEFAULT_PROJECT=main \
7272 basic-memory
7373```
@@ -86,19 +86,19 @@ Basic Memory requires several volume mounts for proper operation:
8686
87872. **Configuration and Database** (Recommended):
8888 ` ` ` yaml
89- - basic-memory-config:/root /.basic-memory:rw
89+ - basic-memory-config:/app /.basic-memory:rw
9090 ` ` `
9191 Persistent storage for configuration and SQLite database.
9292
93- You can edit the basic-memory config.json file located in the /root /.basic-memory/config.json after Basic Memory starts.
93+ You can edit the basic-memory config.json file located in the /app /.basic-memory/config.json after Basic Memory starts.
9494
95953. **Multiple Projects** (Optional):
9696 ` ` ` yaml
9797 - /path/to/project1:/app/data/project1:rw
9898 - /path/to/project2:/app/data/project2:rw
9999 ` ` `
100100
101- You can edit the basic-memory config.json file located in the /root /.basic-memory/config.json
101+ You can edit the basic-memory config.json file located in the /app /.basic-memory/config.json
102102
103103## CLI Commands via Docker
104104
@@ -123,7 +123,7 @@ When using Docker volumes, you'll need to configure projects to point to your mo
123123
1241241. **Check current configuration:**
125125 ` ` ` bash
126- docker exec basic-memory-server cat /root /.basic-memory/config.json
126+ docker exec basic-memory-server cat /app /.basic-memory/config.json
127127 ` ` `
128128
1291292. **Add a project for your mounted volume:**
@@ -184,16 +184,47 @@ environment:
184184
185185# ## Linux/macOS
186186
187- Ensure your knowledge directories have proper permissions :
187+ The Docker container now runs as a non-root user to avoid file ownership issues. By default, the container uses UID/GID 1000, but you can customize this to match your user :
188188
189189` ` ` bash
190- # Make directories readable/writable
191- chmod -R 755 /path/to/your/obsidian-vault
190+ # Build with custom UID/GID to match your user
191+ docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t basic-memory .
192192
193- # If using specific user/group
194- chown -R $USER:$USER /path/to/your/obsidian-vault
193+ # Or use docker-compose with build args
195194` ` `
196195
196+ **Example docker-compose.yml with custom user:**
197+ ` ` ` yaml
198+ version: '3.8'
199+ services:
200+ basic-memory:
201+ build:
202+ context: .
203+ dockerfile: Dockerfile
204+ args:
205+ UID: 1000 # Replace with your UID
206+ GID: 1000 # Replace with your GID
207+ container_name: basic-memory-server
208+ ports:
209+ - "8000:8000"
210+ volumes:
211+ - /path/to/your/obsidian-vault:/app/data:rw
212+ - basic-memory-config:/app/.basic-memory:rw
213+ environment:
214+ - BASIC_MEMORY_DEFAULT_PROJECT=main
215+ restart: unless-stopped
216+ ` ` `
217+
218+ **Using pre-built images:**
219+ If using the pre-built image from GitHub Container Registry, files will be created with UID/GID 1000. You can either :
220+
221+ 1. Change your local directory ownership to match :
222+ ` ` ` bash
223+ sudo chown -R 1000:1000 /path/to/your/obsidian-vault
224+ ` ` `
225+
226+ 2. Or build your own image with custom UID/GID as shown above.
227+
197228# ## Windows
198229
199230When using Docker Desktop on Windows, ensure the directories are shared :
@@ -217,7 +248,7 @@ When using Docker Desktop on Windows, ensure the directories are shared:
217248 ` ` `
218249
2192502. **Configuration Not Persisting:**
220- - Use named volumes for `/root /.basic-memory`
251+ - Use named volumes for `/app /.basic-memory`
221252 - Check volume mount permissions
222253
2232543. **Network Connectivity:**
@@ -243,10 +274,10 @@ docker-compose logs -f basic-memory
243274# # Security Considerations
244275
2452761. **Docker Security:**
246- The container runs as root for simplicity. For production, consider additional security measures .
277+ The container runs as a non- root user (UID/GID 1000 by default) for improved security. You can customize the user ID using build arguments to match your local user .
247278
2482792. **Volume Permissions:**
249- Ensure mounted directories have appropriate permissions and don't expose sensitive data.
280+ Ensure mounted directories have appropriate permissions and don't expose sensitive data. With the non-root container, files will be created with the specified user ownership.
250281
2512823. **Network Security:**
252283 If using HTTP transport, consider using reverse proxy with SSL/TLS and authentication if the endpoint is available on
@@ -288,7 +319,7 @@ For Docker-specific issues:
2883191. Check the [troubleshooting section](#troubleshooting) above
2893202. Review container logs : ` docker-compose logs basic-memory`
2903213. Verify volume mounts : ` docker inspect basic-memory-server`
291- 4. Test file permissions : ` docker exec basic-memory-server ls -la /root `
322+ 4. Test file permissions : ` docker exec basic-memory-server ls -la /app `
292323
293324For general Basic Memory support, see the main [README](../README.md)
294325and [documentation](https://memory.basicmachines.co/).
0 commit comments