[GH-ISSUE #4197] During container deployment, ollama reads model files on the host very slowly #28370

Closed
opened 2026-04-22 06:30:48 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @ChaoII on GitHub (May 6, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4197

Originally assigned to: @dhiltgen on GitHub.

What is the issue?

When I deployed ollama in the container and hung the model path on the host, I kept loading the model files externally by accessing ollama's chat model, which was very, very slow, maybe only 20M/s. I'm using Docker Desktop, using the WSL2 backend, and the files are mounted on the SSD.

OS

Docker

GPU

Nvidia

CPU

Intel

Ollama version

all version

Originally created by @ChaoII on GitHub (May 6, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4197 Originally assigned to: @dhiltgen on GitHub. ### What is the issue? When I deployed ollama in the container and hung the model path on the host, I kept loading the model files externally by accessing ollama's chat model, which was very, very slow, maybe only 20M/s. I'm using Docker Desktop, using the WSL2 backend, and the files are mounted on the SSD. ### OS Docker ### GPU Nvidia ### CPU Intel ### Ollama version all version
GiteaMirror added the wslquestionwindows labels 2026-04-22 06:30:49 -05:00
Author
Owner

@bauersimon commented on GitHub (May 6, 2024):

Have you already looked at the following FAQ? https://github.com/ollama/ollama/blob/main/docs/faq.md#why-is-networking-slow-in-wsl2-on-windows-10

<!-- gh-comment-id:2095630705 --> @bauersimon commented on GitHub (May 6, 2024): Have you already looked at the following FAQ? https://github.com/ollama/ollama/blob/main/docs/faq.md#why-is-networking-slow-in-wsl2-on-windows-10
Author
Owner

@ChaoII commented on GitHub (May 6, 2024):

I've seen the FAQ, but I don't know if reading the host model file has anything to do with networking.

services:
  ollama:
    container_name: ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    image: ollama/ollama
      #tty: true
    restart: always
    environment:
    - OLLAMA_ORIGINS="*"
    - OLLAMA_HOST="0.0.0.0:11434"
    ports:
      - 11434:11434
    volumes:
      - C:/Users/xx/.ollama:/root/.ollama:cached
<!-- gh-comment-id:2095639960 --> @ChaoII commented on GitHub (May 6, 2024): I've seen the FAQ, but I don't know if reading the host model file has anything to do with networking. ```yml services: ollama: container_name: ollama deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu] image: ollama/ollama #tty: true restart: always environment: - OLLAMA_ORIGINS="*" - OLLAMA_HOST="0.0.0.0:11434" ports: - 11434:11434 volumes: - C:/Users/xx/.ollama:/root/.ollama:cached ```
Author
Owner

@zzzhouuu commented on GitHub (May 7, 2024):

To get the best out of the file system performance when bind-mounting files, it's recommended that you store source code and other data that is bind-mounted into Linux containers. For instance, use docker run -v : in the Linux file system, rather than the Windows file system. You can also refer to the recommendation from Microsoft.

Linux containers only receive file change events, “inotify events”, if the original files are stored in the Linux filesystem. For example, some web development workflows rely on inotify events for automatic reloading when files have changed.

Performance is much higher when files are bind-mounted from the Linux filesystem, rather than remoted from the Windows host. Therefore avoid docker run -v /mnt/c/users:/users, where /mnt/c is mounted from Windows.

Instead, from a Linux shell use a command like docker run -v ~/my-project:/sources where ~ is expanded by the Linux shell to $HOME.

<!-- gh-comment-id:2097402124 --> @zzzhouuu commented on GitHub (May 7, 2024): To get the best out of the file system performance when bind-mounting files, it's recommended that you store source code and other data that is bind-mounted into Linux containers. For instance, use docker run -v <host-path>:<container-path> in the Linux file system, rather than the Windows file system. You can also refer to the [recommendation](https://learn.microsoft.com/en-us/windows/wsl/compare-versions) from Microsoft. Linux containers only receive file change events, “inotify events”, if the original files are stored in the Linux filesystem. For example, some web development workflows rely on inotify events for automatic reloading when files have changed. Performance is much higher when files are bind-mounted from the Linux filesystem, rather than remoted from the Windows host. Therefore avoid docker run -v /mnt/c/users:/users, where /mnt/c is mounted from Windows. Instead, from a Linux shell use a command like docker run -v ~/my-project:/sources <my-image> where ~ is expanded by the Linux shell to $HOME.
Author
Owner

@zzzhouuu commented on GitHub (May 7, 2024):

Since the cross-system file compatibility issue between Windows and Linux cannot be well resolved, the performance of accessing Windows files under WSL 2 will be very poor.

<!-- gh-comment-id:2097404628 --> @zzzhouuu commented on GitHub (May 7, 2024): Since the cross-system file compatibility issue between Windows and Linux cannot be well resolved, the performance of accessing Windows files under WSL 2 will be very poor.
Author
Owner

@dhiltgen commented on GitHub (Jul 25, 2024):

WSL I/O performance between linux/windows is known to be slow. To get the best possible performance in a Linux container running in WSL, the files should be stored in the linux filesystem, not the Windows filesystem. If you want to keep the data on the windows filesystem, you should consider running our Windows Ollama install instead of using a linux container.

<!-- gh-comment-id:2251133509 --> @dhiltgen commented on GitHub (Jul 25, 2024): WSL I/O performance between linux/windows is known to be slow. To get the best possible performance in a Linux container running in WSL, the files should be stored in the linux filesystem, not the Windows filesystem. If you want to keep the data on the windows filesystem, you should consider running our Windows Ollama install instead of using a linux container.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#28370