
The easiest way to run LLM locally with Docker
This article will be as short as it is easy to set up, provided you already have Docker installed on your machine.
This solution works on any machine because it only uses the CPU, which is available on every machine that works :)
Docker Compose:
services:
webui:
image: ghcr.io/open-webui/open-webui:main
container_name: llm-webui
ports:
- 4444:8080/tcp
volumes:
- /mnt/Docker/llm/open-webui:/app/backend/data
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- ollama
environment:
- OLLAMA_BASE_URL=http://192.168.1.30:11434
- USER_AGENT=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
cpus: 1
mem_limit: 2G
pids_limit: 100
ollama:
image: ollama/ollama
container_name: llm-ollama
ports:
- 11434:11434/tcp
healthcheck:
test: ollama --version || exit 1
volumes:
- /mnt/Docker/llm/ollama:/root/.ollama
cpus: 3
mem_limit: 10G
pids_limit: 400Change the OLLAMA_BASE_URL variable to the IP address corresponding to your machine, and add the path corresponding to your machine in the volumes section.
When you're ready, start the stack.
After that you can reach the webUI on this URL (modify the IP):192.168.1.30:4444
Download libaries
This is also very simple. Select an LLM from this link, then modify the command below accordingly, e.g.:docker exec -it llm-ollama ollama pull llama3.2-vision:11b
List currently installed libaries:docker exec -it llm-ollama ollama list
Remove one of them:docker exec -it llm-ollama ollama rm llama3.2-vision:11b
Note: I have observed that roughly the same amount of memory is required as the size of the library.
That's it. It wasn't that hard, was it? :)








Comments