Update OLLAMA_KEEP_ALIVE setting in docker-compose.yml to disable keep-alive

This commit is contained in:
ArnabChatterjee20k committed 2026-03-10 15:53:51 +05:30
1 parent 52e2276445
commit 843dfa5c6c
2 files changed
+1 -24

No files matched your search

+1 -1
View File
@@ -1345,7 +1345,7 @@ services:
args:
MODELS: ${_APP_EMBEDDING_MODELS:-embeddinggemma}
# duration to keep model in memory
OLLAMA_KEEP_ALIVE: 24h
OLLAMA_KEEP_ALIVE: -1
container_name: ollama
ports:
- "11434:11434"
-23
View File
@@ -1,23 +0,0 @@
FROM ollama/ollama:0.12.7
# Preload specific models
ARG MODELS
# needed to set in the environment
ARG OLLAMA_KEEP_ALIVE
ENV OLLAMA_KEEP_ALIVE=${OLLAMA_KEEP_ALIVE:-24h}
# Pre-pull models at build time for Docker layer caching
RUN ollama serve & \
sleep 5 && \
for m in $MODELS; do \
echo "Pulling model $m..."; \
ollama pull $m || exit 1; \
done && \
pkill ollama
# Expose Ollama default port
EXPOSE 11434
# On container start, quickly ensure models exist (no re-download unless missing)
ENTRYPOINT ["/bin/bash", "-c", "(sleep 2; for m in $MODELS; do ollama list | grep -q $m || ollama pull $m; done) & exec ollama $0"]
CMD ["serve"]