- This is jank.
- Modify setup_model.sh to change the AI model in use. If you change the model, you may need to delete the "ollama_data" folder.
- This setup assumes that you're using an Nvidia GPU and have the Nvidia Container Toolkit setup on the host OS.
- Steps to running this:
- Download files from the gist to a folder.
- Open a terminal to that folder, and run
docker-compose up
- After everything is running, the web UI should be available on http://localhost:3000
Last active
January 28, 2025 19:00
-
-
Save jpsutton/2ba0cdda57d7c03c83fa2c887947f506 to your computer and use it in GitHub Desktop.
Run AI models on Docker Compose in a more secure way (no egress)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
temporary: | |
image: ollama/ollama | |
volumes: | |
- ./ollama_data:/root/.ollama | |
- ./setup_model.sh:/setup_model.sh | |
entrypoint: ["/bin/bash", "-c"] | |
command: ["/setup_model.sh"] | |
backend: | |
image: ollama/ollama | |
runtime: nvidia | |
environment: | |
- NVIDIA_VISIBLE_DEVICES=all | |
volumes: | |
- ./ollama_data:/root/.ollama | |
networks: | |
- internal | |
depends_on: | |
temporary: | |
condition: service_completed_successfully | |
frontend: | |
networks: | |
- internal | |
- default | |
image: ghcr.io/open-webui/open-webui:main | |
volumes: | |
- ./open_webui_data:/app/backend/data | |
environment: | |
- OLLAMA_BASE_URL=http://backend:11434 | |
depends_on: | |
backend: | |
condition: service_started | |
ports: | |
- "3000:8080" | |
networks: | |
internal: | |
internal: true | |
default: | |
driver: bridge | |
volumes: | |
ollama_data: | |
driver: local | |
open_webui_data: | |
driver: local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
ollama serve & | |
ollama_pid=$! | |
sleep 2s | |
# Change this line to specify a different AI model | |
ollama pull deepseek-r1:7b | |
sleep 2s | |
kill -9 $ollama_pid | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changes needed for AMD GPU use (tested on my system with a Radeon RX 6600 XT):
The
HSA_OVERRIDE_GFX_VERSION
env var is probably not needed on a card which is officially supported by ROCm.