Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Fix Docker volume permissions error for /data directory

tombii76247ff048d6
diff --git a/Dockerfile b/Dockerfile
index aa3f045155..52d9ade9ba 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -153,6 +153,8 @@ RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y \
sqlcipher \
libsqlcipher1 \
+ # gosu for safe user switching in entrypoint
+ gosu \
# WeasyPrint dependencies for PDF generation
libcairo2 \
libpango-1.0-0 \
@@ -194,14 +196,19 @@ VOLUME /scripts/
ADD scripts/ollama_entrypoint.sh /scripts/ollama_entrypoint.sh
RUN chmod +x /scripts/ollama_entrypoint.sh
-# Ensure all directories are owned by ldruser before switching
+# Copy LDR entrypoint script to handle volume permissions
+COPY scripts/ldr_entrypoint.sh /usr/local/bin/ldr_entrypoint.sh
+RUN chmod +x /usr/local/bin/ldr_entrypoint.sh
+
+# Ensure all directories are owned by ldruser
RUN chown -R ldruser:ldruser /install /scripts /home/ldruser
EXPOSE 5000
STOPSIGNAL SIGINT
-# Switch to non-root user for running service (security best practice)
-USER ldruser
+# Use entrypoint to fix volume permissions, then switch to ldruser
+# The entrypoint runs as root to fix /data permissions, then drops to ldruser
+ENTRYPOINT ["/usr/local/bin/ldr_entrypoint.sh"]
-# Use PDM to run the application
+# Use PDM to run the application (passed to entrypoint as $@)
CMD [ "ldr-web" ]
diff --git a/scripts/ldr_entrypoint.sh b/scripts/ldr_entrypoint.sh
new file mode 100755
index 0000000000..97b7ac9f0f
--- /dev/null
+++ b/scripts/ldr_entrypoint.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -e
+
+# This entrypoint handles volume permissions for the LDR container.
+# Docker volumes are created with root ownership, but we need them
+# accessible to the ldruser (UID 1000) that runs the application.
+
+echo "Setting up /data directory permissions..."
+
+# Create required subdirectories under /data if they don't exist
+mkdir -p /data/logs
+mkdir -p /data/cache
+mkdir -p /data/research_outputs
+mkdir -p /data/encrypted_databases
+
+# Set permissions to 700 (owner-only access for security)
+chmod 700 /data/logs
+chmod 700 /data/cache
+chmod 700 /data/research_outputs
+chmod 700 /data/encrypted_databases
+
+# Fix ownership of /data and all subdirectories
+# This is safe because we're still root at this point (before USER directive takes effect)
+chown -R ldruser:ldruser /data
+
+echo "Starting LDR application as ldruser..."
+
+# Switch to ldruser and execute the command
+exec gosu ldruser "$@"