Install, update, stop and uninstall Ollama on Docker, Linux, macOS and Windows

· in self-hosted AI

Docker steps tested on Fedora 44 with Docker 29.9.2, the ollama/ollama 0.40.15 and 0.30.10 images and an RTX 3090 (24 GB) on 8 November 2026. Linux script, macOS and Windows steps are from Ollama's documentation and install scripts.

Setup card for Ollama in Docker: install with docker run --gpus=all and the models in the ollama volume, stop with ollama stop (unloads a model) or docker stop (stops the server), update to a newer image with the same volume so the models stay, uninstall by removing the container, the volume and the image. Measured: about 944 tokens/s with --gpus=all for qwen3:0.6b at a 32k context, against 157 to 167 on the CPU at 4k; the first request on the GPU took 25 s to load the model; ollama rm of a 725 MB model left the models folder at 757 MB, down from 1.5 GB; the ollama/ollama:0.40.15 image is 8.5 GB on disk. Key point: without --gpus=all Ollama ran on the CPU, and removing a copied tag freed nothing because both names used the same files. Ollama 0.40.15 and 0.30.10, RTX 3090 (24 GB), Fedora 44, Docker 29.9.2, 8 November 2026.

This page covers the whole life of an Ollama install: installing it, checking that it uses the GPU, listing and deleting models, stopping and updating the server, and removing it completely. Each task has the commands for Docker, for the Linux install script, for macOS and for Windows.

The Docker steps were run on a test machine and the results are measured. The native Linux, macOS and Windows steps were not run here. They come from Ollama's documentation and its install scripts, and each one links to the page it comes from. Figures without a link were measured in this test. The test scripts and logs for the Docker steps are on GitHub.

The short version

TaskDockerLinux (install script)macOS / Windows
Installdocker run -d --gpus=all -v ollama:/root/.ollama -p 127.0.0.1:11434:11434 --name ollama ollama/ollama:0.40.15curl -fsSL https://ollama.com/install.sh | shDownload the app, or run the install script (macOS) or install.ps1 (Windows)
List modelsdocker exec ollama ollama listollama listollama list
Unload a model from memorydocker exec ollama ollama stop MODELollama stop MODELollama stop MODEL
Stop the serverdocker stop ollamasudo systemctl stop ollamaQuit the app from the menu bar or taskbar
UpdatePull a newer image and recreate the containerRun the install script again"Restart to update" in the app
Delete a modeldocker exec ollama ollama rm MODELollama rm MODELollama rm MODEL (also in PowerShell)
UninstallRemove the container, the volume and the imageRemove the service, binary, libraries, user and modelsDelete the app, its Library folders and ~/.ollama (macOS), or use Add or remove programs (Windows)

What was tested

The test machine runs Fedora 44 with Docker 29.9.2, an RTX 3090 with 24 GB and NVIDIA driver 615.78.08. Ollama ran from the official ollama/ollama image, version 0.40.15 (released on 3 November 2026), and version 0.30.10 for the update test. Each test used its own container and volume, and all of them were removed afterwards. The models were small ones from the Ollama library: smollm2:135m (270 MB), smollm2:360m (725 MB), qwen3:0.6b (522 MB) and qwen3:1.7b (1.4 GB).

Ollama was not installed directly on the host, so the native steps below are not tested.

Install Ollama

Docker, without a GPU

Ollama's Docker docs start a CPU-only container with one command. The volume named ollama holds the models, so they survive when the container is removed:

docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

This publishes port 11434 on every network interface, and the Ollama API has no password. On a home server, publish it on the loopback address only, as the test containers did with -p 127.0.0.1:11434:11434. Use a version tag such as ollama/ollama:0.40.15 instead of the default latest, so the version changes only when you change it. The 0.40.15 image is 8.5 GB on disk.

Run a model inside the container with docker exec:

docker exec -it ollama ollama run qwen3:0.6b

Docker with an NVIDIA GPU

A container sees an NVIDIA GPU only after the NVIDIA Container Toolkit is installed on the host. The Docker docs then add --gpus=all:

docker run -d --gpus=all -v ollama:/root/.ollama -p 127.0.0.1:11434:11434 --name ollama ollama/ollama:0.40.15

For AMD GPUs the Docker docs use the ollama/ollama:rocm image and pass --device /dev/kfd --device /dev/dri instead of --gpus.

To check what the server found, read its log. With --gpus=all the test container logged the card:

docker logs ollama 2>&1 | grep "inference compute"
msg="inference compute" id=0 library=CUDA compute=8.6 name=CUDA0 description="NVIDIA GeForce RTX 3090" ... total="23.6 GiB" available="15.9 GiB"

Key point: without --gpus=all, the same line said id=cpu library=cpu, and Ollama ran on the CPU. If Ollama in Docker does not use your GPU, check this flag first.

The PROCESSOR column of ollama ps also shows whether a loaded model runs on the CPU or the GPU. The same qwen3:0.6b model gave these results in the two containers:

ContainerPROCESSORCONTEXTSIZE in memoryGeneration speed
No --gpus100% CPU4,0961.0 GB157 to 167 tokens/s
--gpus=all100% GPU32,7684.3 GBabout 944 tokens/s
Bar chart of generation speed for qwen3:0.6b in Ollama 0.40.15: 157 to 167 tokens per second in the container without --gpus (100% CPU, 4,096 context) and about 944 tokens per second with --gpus=all (100% GPU, 32,768 context)
Generation speed of the same small model in the two containers. The CPU-only container ran at 157 to 167 tokens/s and the --gpus=all container at about 944.

The context size differs because Ollama picks a default context from the GPU memory it finds. With no GPU it used 4,096 tokens. The larger context is why the model took 4.3 GB on the GPU.

Tip: the first request after the GPU container started took 25 seconds to load the model, and that first request reported only 0.28 tokens/s. The next requests ran at about 944 tokens/s. If the first answer is slow, time the second one before you decide the GPU is not working.

On Linux, if Ollama falls back to the CPU after the machine wakes from sleep, Ollama's GPU page says to reload the driver module with sudo rmmod nvidia_uvm && sudo modprobe nvidia_uvm. The same page lists the supported cards: NVIDIA compute capability 5.0 and newer with driver 550 or newer.

Docker Compose

This Compose file starts the same container, and it was tested with docker compose up -d. The GPU block uses the syntax from Docker's Compose GPU guide. The log showed the RTX 3090, the same result as the --gpus=all container. Leave out the deploy block on a machine without an NVIDIA GPU.

services:
  ollama:
    image: ollama/ollama:0.40.15
    container_name: ollama
    ports:
      - "127.0.0.1:11434:11434"
    volumes:
      - ollama:/root/.ollama
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
volumes:
  ollama:

With restart: unless-stopped, the container starts again after a reboot unless you stopped it yourself.

Linux without Docker

The Linux docs install Ollama with one script:

curl -fsSL https://ollama.com/install.sh | sh

Read the script before you pipe it to a shell. The install script does more than copy a binary:

  • It installs Ollama under /usr/local (or /usr, depending on your PATH): the ollama binary in bin and its libraries in lib/ollama.
  • It creates a system user and group called ollama, with the home folder /usr/share/ollama, and adds your own user to the ollama group.
  • It writes /etc/systemd/system/ollama.service with Restart=always, then enables and starts the service.
  • If it finds an NVIDIA GPU but no working driver, it adds NVIDIA's CUDA repository and installs the cuda-drivers package with dnf, yum or apt.

The docs also describe a manual install: extract ollama-linux-amd64.tar.zst into /usr and create the user and the service yourself. AMD cards need the extra ollama-linux-amd64-rocm.tar.zst package, and ARM machines use ollama-linux-arm64.tar.zst.

macOS

The macOS docs ask for macOS Sonoma (14) or newer. Apple Silicon Macs get CPU and GPU support, and Intel Macs run on the CPU only. The usual install is the app: open ollama.dmg and drag Ollama to Applications. On first start the app offers to link the ollama command into /usr/local/bin.

The macOS download page also offers the same install.sh as Linux. On a Mac the script downloads the app, moves it to /Applications and links the command. Homebrew has both a formula, brew install ollama, and an app cask, ollama-app. Both were at version 0.40.15 on 8 November 2026. These are Homebrew's packages, not Ollama's own installer.

Windows

The Windows docs ask for Windows 10 22H2 or newer and, with an NVIDIA card, driver 551.61 or newer. OllamaSetup.exe installs Ollama in your user account without administrator rights and needs at least 4 GB for the program. After install, Ollama runs in the background and the ollama command works in cmd and PowerShell. To install somewhere other than your home folder, start the installer with OllamaSetup.exe /DIR="D:\Ollama".

The Windows download page also gives a PowerShell one-liner:

irm https://ollama.com/install.ps1 | iex

install.ps1 downloads OllamaSetup.exe and runs it. It reads OLLAMA_VERSION for a specific version and OLLAMA_INSTALL_DIR for another folder.

Check the installed version

ollama --version                    # native install
docker exec ollama ollama --version # Docker

In the test container this printed ollama version is 0.40.15. The server also answers on http://127.0.0.1:11434/api/version with {"version":"0.40.15"}.

List models and see where they are stored

ollama list, or its short form ollama ls, lists the models on disk:

$ docker exec ollama ollama list
NAME            ID              SIZE      MODIFIED
qwen3:0.6b      7df6b6e09427    522 MB    Less than a second ago
smollm2:360m    297281b699fc    725 MB    2 minutes ago
smollm2:135m    9077fe9d2ae1    270 MB    5 minutes ago

ollama ps lists the models loaded in memory, with how long each stays loaded. The same lists come from the API, at /api/tags and /api/ps:

curl http://127.0.0.1:11434/api/tags
curl http://127.0.0.1:11434/api/ps

Searches for an "Ollama models list" often mean the models you can download, not the ones you have. Those are in the Ollama library.

The Ollama FAQ gives the default model folders, and OLLAMA_MODELS moves them anywhere else:

  • Linux (install script): /usr/share/ollama/.ollama/models
  • macOS: ~/.ollama/models
  • Windows: C:\Users\%username%\.ollama\models
  • Docker: /root/.ollama/models inside the container. With a named volume, Docker keeps the files on the host under /var/lib/docker/volumes/ollama/_data, as docker volume inspect ollama showed on the test machine.

Each folder has a manifests folder with one small file per model tag and a blobs folder with the model files, named by their SHA-256 hash.

Stop Ollama

"Stop" means two different things: unload a model from memory, or stop the server.

Unload a model

By default Ollama keeps a model in memory for five minutes after its last request. ollama stop unloads it at once and frees its RAM or GPU memory. The server keeps running:

ollama stop qwen3:0.6b

In the test, ollama ps listed smollm2:135m with 383 MB in memory. Its UNTIL column said "4 minutes from now", which is when Ollama would unload it. After ollama stop smollm2:135m, the list was empty. Over the API, a request with "keep_alive": 0 unloads the model, and the OLLAMA_KEEP_ALIVE setting changes the five-minute default for all models.

Stop the server in Docker

docker stop ollama      # stop
docker start ollama     # start again
docker restart ollama   # restart

Each of these took under half a second on the test machine. While the container was stopped, the API did not answer. The models stay in the volume.

Stop the server on Linux (Ubuntu, Fedora and others)

The install script runs Ollama as a systemd service, so stop it with systemctl. The Linux docs use the same commands:

sudo systemctl stop ollama      # stop now
sudo systemctl disable ollama   # don't start at boot
sudo systemctl start ollama     # start again
sudo systemctl restart ollama   # restart, e.g. after a config change

Key point: killing the process does not work for long. The service file has Restart=always with RestartSec=3, so systemd starts a new server three seconds later.

In GitHub issue #707, a user killed the Ollama process, ran ollama serve again and got the same "address already in use" error. Use journalctl -e -u ollama to read the service log.

Stop the app on macOS and Windows

The desktop app runs the server. Quit Ollama from its icon in the menu bar (macOS) or the taskbar (Windows). The Windows docs tell you to quit the tray app before changing settings, then start it again from the Start menu.

"bind: address already in use"

This error means a server is already listening on port 11434, usually the service or app you installed. Running ollama serve inside the running test container gave the same message:

Error: listen tcp 0.0.0.0:11434: bind: address already in use

You don't need ollama serve when the service, the app or the container is running. The ollama commands talk to that server. If you want to start ollama serve by hand, for example with different settings, stop the service first with sudo systemctl stop ollama, or quit the app.

In Docker the clash happens on the host. A second container that publishes the same host port fails to start. The test containers used host port 11535, and the error was Bind for 127.0.0.1:11535 failed: port is already allocated. Remove the old container or publish a different host port.

Update Ollama

Docker

Updating in Docker means running a newer image with the same volume. The test went from 0.30.10 to 0.40.15:

docker pull ollama/ollama:0.40.15
docker rm -f ollama
docker run -d --gpus=all -v ollama:/root/.ollama -p 127.0.0.1:11434:11434 --name ollama ollama/ollama:0.40.15

After the swap, ollama --version reported 0.40.15 and ollama list still showed qwen3:0.6b, which had been downloaded with 0.30.10. With Compose, change the tag in the file, then run docker compose pull and docker compose up -d.

The latest tag only changes when you pull it. On the test machine, a latest image pulled months earlier was still 0.30.10, so a container started from it ran the old version.

Linux

The Linux docs update Ollama by running the install script again. To get one specific version, set OLLAMA_VERSION:

curl -fsSL https://ollama.com/install.sh | sh
curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION=0.40.15 sh

If you installed by hand from the archive, the docs say to remove the old libraries with sudo rm -rf /usr/lib/ollama before extracting the new version.

macOS and Windows

The FAQ says the apps download updates by themselves. Click the Ollama icon and choose "Restart to update", or download the latest version again. Homebrew installs update with brew upgrade.

Update a model

Models don't update with Ollama. To get the newest version of a model tag, pull it again: ollama pull qwen3:0.6b.

Delete Ollama models

ollama rm deletes a model. It accepts several names at once, and it works the same in Bash, cmd and PowerShell:

ollama rm qwen3:0.6b
ollama rm smollm2:360m smollm2:135m
docker exec ollama ollama rm qwen3:0.6b   # Docker

Use the full name with the tag, as ollama list shows it. The API does the same with a DELETE request to /api/delete. In the test it returned HTTP 200 for a model that existed, and HTTP 404 with {"error":"model 'qwen3:0.6b' not found"} when it was called again:

curl -X DELETE http://127.0.0.1:11434/api/delete -d '{"model":"qwen3:0.6b"}'

Deleting a model that is loaded also unloads it. After ollama rm on a running model, ollama ps was empty.

How much disk space ollama rm frees: nothing while another tag shares the files

The test measured the models folder after each step:

StepModels folderBlob files
Three models pulled1.5 GB16
ollama cp smollm2:135m my-smollm1.5 GB (+9 KB)16
ollama rm my-smollm1.5 GB16
ollama rm smollm2:360m757 MB13
ollama rm qwen3:0.6b259 MB7
Bar chart of the Ollama models folder size after each step: 1.5 GB with three models pulled, 1.5 GB (+9 KB) after ollama cp smollm2:135m my-smollm, 1.5 GB after ollama rm my-smollm, 757 MB after ollama rm smollm2:360m and 259 MB after ollama rm qwen3:0.6b
Size of the models folder after each step. Removing the copied tag freed nothing, and removing a model that no other tag used freed its files.

Why: a copied or renamed tag points to the same blob files: ollama list showed both names with the same ID, 9077fe9d2ae1. Deleting one name frees nothing while another name still uses the files. Ollama deletes the blobs when the last name that uses them is gone.

Don't delete files in the blobs folder by hand. The file names are hashes, so you can't tell which model a blob belongs to, and a blob can belong to several models. ollama rm keeps the manifests and blobs in step.

Interrupted downloads: ollama rm can't remove the partial files

A download stopped part-way leaves files ending in -partial in the blobs folder. In the test, stopping ollama pull qwen3:1.7b after about 12 seconds left 15 such files. The model did not appear in ollama list, and ollama rm qwen3:1.7b answered Error: model 'qwen3:1.7b' not found. The files were still there after the container restarted.

Running the same ollama pull again finished the download, and no -partial files were left afterwards. If you no longer want that model, finish the pull and then remove it with ollama rm.

Uninstall Ollama completely

Docker

A Docker install leaves three things: the container, the volume with the models and the image.

docker rm -f ollama            # the container
docker volume rm ollama        # the models
docker rmi ollama/ollama:0.40.15   # the image, 8.5 GB

With Compose, docker compose down removes the container and the network. It keeps named volumes unless you add -v. In the test the volume held 271 MB with one small model left, as docker system df -v reported. That is the same size as the 259 MB in the table above, which du counts in mebibytes. If you mounted a host folder instead of a volume, for example -v ~/ollama:/root/.ollama, delete that folder yourself.

docker rmi refuses to remove an image that another container still uses, so check docker ps -a first.

Linux

These steps are from the Linux docs and match what the install script creates:

sudo systemctl stop ollama
sudo systemctl disable ollama
sudo rm /etc/systemd/system/ollama.service
sudo rm -r $(which ollama | tr 'bin' 'lib')
sudo rm $(which ollama)
sudo userdel ollama
sudo groupdel ollama
sudo rm -r /usr/share/ollama

If groupdel reports that the group does not exist, userdel already removed it. The fourth line removes the libraries. tr 'bin' 'lib' turns the binary's path, such as /usr/local/bin/ollama, into the library path /usr/local/lib/ollama. Run it before the line that deletes the binary, because which ollama stops working after that. The last line deletes the downloaded models.

Check these too, because the uninstall steps don't cover them:

  • A custom model folder. If you set OLLAMA_MODELS, the models are there, not in /usr/share/ollama.
  • The NVIDIA driver. If the install script installed cuda-drivers and added NVIDIA's repository, they stay. Other programs may use the driver, so remove it only if you know nothing else needs it.
  • The systemd cache. Run sudo systemctl daemon-reload after deleting the service file, so systemd forgets the unit.

macOS

The macOS docs list the files to delete. Quit Ollama first. The last line deletes your models:

sudo rm -rf /Applications/Ollama.app
sudo rm /usr/local/bin/ollama
rm -rf "$HOME/Library/Application Support/Ollama"
rm -rf "$HOME/Library/Saved Application State/com.electron.ollama.savedState"
rm -rf ~/Library/Caches/com.electron.ollama/
rm -rf ~/Library/Caches/ollama
rm -rf ~/Library/WebKit/com.electron.ollama
rm -rf ~/.ollama

The docs quote these paths as "~/Library/...". The shell does not expand ~ inside quotes, so the commands above use $HOME for the two quoted paths. If you installed with Homebrew, run brew uninstall ollama or brew uninstall --cask ollama-app instead of the first two lines.

Windows

The Windows docs uninstall Ollama from Settings → Apps → Add or remove programs. install.ps1 can also start the uninstaller from PowerShell:

$env:OLLAMA_UNINSTALL=1; irm https://ollama.com/install.ps1 | iex

The script opens the normal uninstaller window, which lets you choose whether to keep the models. The docs say that if you moved the models with OLLAMA_MODELS, the uninstaller does not remove them. Afterwards, check these folders and delete what is left:

  • %HOMEPATH%\.ollama: models and configuration
  • %LOCALAPPDATA%\Ollama: logs and downloaded updates
  • %LOCALAPPDATA%\Programs\Ollama: the program
  • ollama* folders in %TEMP%

Frequently asked questions

How do I stop Ollama on Ubuntu?

Run sudo systemctl stop ollama, and sudo systemctl disable ollama if it should not start at boot. Killing the process is not enough, because systemd starts the service again after three seconds.

What is the command to remove an Ollama model?

ollama rm followed by the model name and tag, for example ollama rm qwen3:0.6b. It works the same in PowerShell, and in Docker you run it with docker exec ollama ollama rm qwen3:0.6b.

Does ollama rm free disk space?

Yes, when no other model name uses the same files. In the test, removing a 725 MB model shrank the models folder from 1.5 GB to 757 MB. Removing a copied tag freed nothing, because both names used the same files.

Where does Ollama store models?

In /usr/share/ollama/.ollama/models on Linux, ~/.ollama/models on macOS and C:\Users\%username%\.ollama\models on Windows, unless OLLAMA_MODELS points elsewhere. In Docker they are in /root/.ollama/models inside the container, which is usually a named volume.

How do I update Ollama?

On Linux, run the install script again. The macOS and Windows apps download updates and offer "Restart to update". In Docker, start a container from a newer image with the same volume, and your models stay.

How do I fully uninstall Ollama?

On Linux, remove the service, binary, libraries, the ollama user and group, and /usr/share/ollama. On macOS, delete the app, its Library folders and ~/.ollama. On Windows, use Add or remove programs and then check %HOMEPATH%\.ollama. In Docker, remove the container, the volume and the image.

Sources

  1. Ollama docs: Docker
  2. Ollama docs: Linux
  3. Ollama docs: macOS
  4. Ollama docs: Windows
  5. Ollama docs: FAQ
  6. Ollama docs: Hardware support
  7. Ollama docs: CLI reference
  8. Ollama API: List models, List running models and Delete a model
  9. Ollama install.sh on GitHub
  10. Ollama install.ps1
  11. Ollama download for macOS and for Windows
  12. Ollama v0.40.15 release
  13. Ollama GitHub issue #707: bind: address already in use
  14. Homebrew formula: ollama and cask: ollama-app
  15. NVIDIA Container Toolkit install guide
  16. Docker docs: GPU support in Compose