# Managed by Ansible — do not edit manually services: ollama: image: ollama/ollama:{{ ollama_version }} container_name: ollama restart: unless-stopped environment: OLLAMA_CONTEXT_LENGTH: "{{ ollama_context_length }}" OLLAMA_FLASH_ATTENTION: "1" OLLAMA_KV_CACHE_TYPE: "q8_0" # One model, one request at a time — keeps RAM use predictable on the shared VPS OLLAMA_MAX_LOADED_MODELS: "1" OLLAMA_NUM_PARALLEL: "1" # Unload the model after this idle time to free RAM for the other services OLLAMA_KEEP_ALIVE: "{{ ollama_keep_alive }}" volumes: - {{ ollama_data_dir }}/models:/root/.ollama mem_limit: {{ ollama_mem_limit }} networks: - ollama_internal # Not exposed via Traefik. Containers that need the API join this network # (declared as external there) and reach it at http://ollama:11434. networks: ollama_internal: name: ollama_internal