fix: update docker-compose and Makefile for host networking configuration

This commit is contained in:
2025-06-23 22:09:08 +08:00
parent bc1015aa0d
commit eedc7e4657
2 changed files with 8 additions and 9 deletions
+6 -7
View File
@@ -4,8 +4,7 @@ services:
context: .
network: host
image: localhost/ollama-server:latest
ports:
- "11434:11434" # Map host port 11434 to container port 11434 (Ollama default)
network_mode: host
volumes:
- ./models:/models # Mount a local directory for models
- ollama_data:/usr/share/ollama/.ollama # Persistent storage for Ollama data
@@ -13,7 +12,6 @@ services:
environment:
- OLLAMA_HOST=0.0.0.0
restart: unless-stopped
network_mode: slirp4netns
# Uncomment the following lines if you have NVIDIA GPU support
# deploy:
# resources:
@@ -26,10 +24,10 @@ services:
postgres:
image: docker.io/pgvector/pgvector:pg17
container_name: ollama-postgres
ports:
- "54320:5432"
network_mode: host
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_PORT=54320
volumes:
- ./postgres-data:/var/lib/postgresql/data
restart: unless-stopped
@@ -37,10 +35,11 @@ services:
speaches:
image: ghcr.io/speaches-ai/speaches:latest-cpu
container_name: speaches-server
network_mode: host
volumes:
- hf-hub-cache:/home/ubuntu/.cache/huggingface/hub
ports:
- "8900:8000"
environment:
- PORT=8900
# deploy:
# resources:
# reservations:
+2 -2
View File
@@ -96,7 +96,7 @@ help:
@echo " make ai-launcher Interactive AI backend launcher (recommended for new users)"
@echo ""
@echo "Ollama-specific targets:"
@echo " make ollama-build Build Ollama container with no cache (using slirp4netns)"
@echo " make ollama-build Build Ollama container with no cache (using host networking)"
@echo " make ollama-build-host Build Ollama container with host networking (alternative)"
@echo " make ollama-up Start only the Ollama container"
@echo " make ollama-down Stop only the Ollama container"
@@ -138,7 +138,7 @@ info:
# Ollama-specific targets
ollama-build:
cd ai_stack/ollama && DOCKER_BUILDKIT=0 CONTAINERS_NETNS=slirp4netns podman compose build --no-cache
cd ai_stack/ollama && DOCKER_BUILDKIT=0 podman compose build --no-cache
@echo "Ollama container built with no cache. Use 'make ollama-up' to start it."
ollama-build-host: