Merge b91c94d64a8e194ffbac9506e60116538c8c37ee into d7eb05b9361febead29a74e71ddffc2ebeff5302
This commit is contained in:
commit
293e86bab9
41
examples/docker-compose/README.md
Normal file
41
examples/docker-compose/README.md
Normal 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
|
||||
```
|
||||
|
17
examples/docker-compose/docker-compose.yaml
Normal file
17
examples/docker-compose/docker-compose.yaml
Normal 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
|
Loading…
x
Reference in New Issue
Block a user