--- title : " Ollama Docker Setup: GPU, Volumes and Compose" published : true description : " Ollama Docker setup tested on Docker 29.4.3 and Ollama 0.40.13: persistent volumes, GPU flags for NVIDIA and AMD, a Compose file and the gotchas." tags : ollama, docker, devops, ai canonical_url : https://devtoolhub.com/ollama-docker-setup-gpu-volumes/ --- > Originally published on [DevToolHub](https://devtoolhub.com/ollama-docker-setup-gpu-volumes/).
Running Ollama in a container takes one `docker run` command. That command also decides two things the docs bury: whether your models survive a rebuild, and whether your GPU gets used. This Ollama Docker setup guide covers both. I ran it on Docker 29.4.3 with Ollama 0.40.13 and hit three problems the one-liner doesn't warn you about.
## What Is the Minimum Ollama Docker Setup?
The minimum Ollama Docker setup is one container with a named volume and port 11434 published.…