FROM ollama/ollama:latest # Expose your desired port EXPOSE 7860 # Configure Ollama to listen on all interfaces at port 7860 ENV OLLAMA_HOST=0.0.0.0:7860 # Set environment to disable caching and history ENV OLLAMA_NOHISTORY=true ENV OLLAMA_MULTIUSER_CACHE=false ENV OLLAMA_NOPRUNE=true ENV OLLAMA_MODELS=/tmp/.ollama/models # Create a temporary models directory in memory (optional: may require tmpfs mounting) RUN mkdir -p /tmp/.ollama/models && \ chmod -R 777 /tmp/.ollama/models # Use RAM-based directory (if Docker supports tmpfs) VOLUME ["/tmp/.ollama/models"] # Prevent model/key persistence RUN rm -rf /.ollama && mkdir -p /.ollama && chmod -R 777 /.ollama # Final command to serve CMD ["serve"]