Merge b91c94d64a8e194ffbac9506e60116538c8c37ee into d7eb05b9361febead29a74e71ddffc2ebeff5302

This commit is contained in:
Joey McDonald 2024-11-14 13:58:32 +08:00 committed by GitHub
commit 293e86bab9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,41 @@
# Ollama Service
This Docker Compose setup deploys the Ollama service, using the main ollama image hosted on dockerhub. Ollama is designed to run seamlessly in a Docker environment, with health checks and volume management.
## Prerequisites
- Docker
- Docker Compose
Ensure Docker and Docker Compose are installed and up-to-date on your system.
## Configuration
The service configuration is managed through the `docker-compose.yaml` file and environment variables. You can customize the Ollama service port by setting the `OLLAMA_PORT` environment variable; if not set, it defaults to 11434.
## Getting Started
1. **Run:** To start the Ollama service run:
```bash
docker-compose up -d
```
2. **Build and Run:** To build the project and start the Ollama service, run:
```bash
docker-compose up --build
```
## NOTES:
1. Health Check: The service includes a health check that verifies the application's ability to accept connections on port 11434 (or a custom port if OLLAMA_PORT is set).
2. Accessing Ollama: Once running, Ollama is accessible on localhost at the port specified by OLLAMA_PORT or the default 11434.
3. Volumes: To persist data, the setup mounts a volume from ./ollama to /root/.ollama within the container.
4. Stopping the Service: To stop and remove the Ollama container, use:
```bash
docker-compose down
```

View File

@ -0,0 +1,17 @@
version: "3.8"
services:
ollama:
build:
context: ../..
dockerfile: Dockerfile
container_name: ollama
image: ollama/ollama
healthcheck:
test: ["CMD-SHELL", "/usr/bin/bash -c 'cat < /dev/null > /dev/tcp/localhost/11434 || exit 1'"]
interval: 10s
ports:
- "${OLLAMA_PORT:-11434}:11434"
volumes:
- ./ollama:/root/.ollama
restart: on-failure