Docker: Difference between revisions

Raboof (talk | contribs)
Exposing sockets from the host: note exposing the socket folder may break
Joshbuker (talk | contribs)
Add a section for using nvidia with docker containers
Line 719: Line 719:
Restarting the container or Docker might be required.
Restarting the container or Docker might be required.
</translate>
</translate>
=== NVIDIA Docker Containers ===
If attempting to pass your nvidia gpu through to docker container(s), you will need to install <code>nvidia-container-toolkit</code> and enable cdi.
{{File|3={
  virtualisation.docker.enable = true;
  hardware.nvidia-container-toolkit.enable = true;
  # Regular Docker
  virtualisation.docker.daemon.settings.features.cdi = true;
  # If using Rootless Docker
  # virtualisation.docker.rootless.daemon.settings.features.cdi = true;
}|name=configuration.nix|lang=nix}}
You may also need to adjust your docker compose file to use cdi instead of the nvidia driver.
{{File|3=services:
  ollama:
    image: ollama/ollama
    volumes:
      - ollama:/root/.ollama
    ports:
      - 11434:11434
    deploy:
      resources:
        reservations:
          devices:
            # Go from this:
            # - driver: nvidia
            #  count: all
            #  capabilities: [gpu]
            # To this:
            - driver: cdi
              capabilities: [gpu]
              device_ids:
                - nvidia.com/gpu=all|name=compose.yml|lang=yaml}}


<translate>
<translate>