Created
May 17, 2026 18:58
-
-
Save dfch/128ce8d134719b7d6521e8b3d3dc5d45 to your computer and use it in GitHub Desktop.
Docker Ollama
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
| sudo mkdir -p /data/ollama-models | |
| sudo chown $USER:$USER /data/ollama-models | |
| mkdir -p ~/docker/ollama |
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
| # nano ~/docker/ollama/docker-compose.yml | |
| services: | |
| ollama: | |
| image: ollama/ollama:latest | |
| container_name: ollama | |
| restart: always | |
| ports: | |
| - "11434:11434" | |
| environment: | |
| - OLLAMA_HOST=0.0.0.0 | |
| - OLLAMA_NO_CLOUD=1 | |
| volumes: | |
| - /data/ollama-models:/root/.ollama/models | |
| deploy: | |
| resources: | |
| reservations: | |
| devices: | |
| - driver: nvidia | |
| count: all | |
| capabilities: [gpu] | |
| open-webui: | |
| image: ghcr.io/open-webui/open-webui:main | |
| container_name: open-webui | |
| restart: always | |
| ports: | |
| - "3000:8080" | |
| environment: | |
| - OLLAMA_BASE_URL=http://ollama:11434 | |
| volumes: | |
| - open-webui:/app/backend/data | |
| depends_on: | |
| - ollama | |
| volumes: | |
| open-webui: |
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
| docker run --rm --gpus all nvidia/cuda:12.0-base-ubuntu22.04 nvidia-smi |
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
| docker exec -it ollama ollama list | |
| docker logs ollama | grep -i gpu |
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
| curl -fsSL https://get.docker.com | sh | |
| sudo usermod -aG docker $USER | |
| newgrp docker |
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
| curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg | |
| curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ | |
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ | |
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list | |
| sudo apt update | |
| sudo apt install -y nvidia-container-toolkit | |
| sudo nvidia-ctk runtime configure --runtime=docker | |
| sudo systemctl restart docker |
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
| cd ~/docker/ollama | |
| docker compose up -d | |
| docker compose ps |
Comments are disabled for this gist.