0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wsl2(ubuntu) + docker + ollama環境構築メモ

Last updated at Posted at 2025-07-19

wsl2をインストールする

手段は省略

nvidia driverをWindowsにインストール

手段は省略

wsl2上でnvidia cuda toolkitをインストール

wsl2上でdockerをインストール

dockerのパーミッションを設定する

sudo usermod -aG docker <username>

sudo reboot

NVIDIA Container Toolkitをインストールする

NVIDIA Container Toolkitのgpu利用のコンフィグを有効化

sudo systemctl restart docker

sudo nvidia-ctk runtime configure --runtime=docker

sudo systemctl restart docker

ollama imageを作成・コンテナ起動

docker run -d --gpus=all -v /home/<username>/ollama:/ollama -p 11434:11434 --name

ollama ollama/ollama

コンテナのbash実行

docker exec -it <container_id_or_name> /bin/bash

ollama実行

ollama run deepseek-r1

※この時モデルネームを控えておくとよい
ollama ls

difyのインストール

コンテナの自動起動化

docker update --restart=always $(docker ps -aq)

ブラウザからlocalhostでDifyにアクセス

http://localhost

ollama設定

設定→モデルプロバイダからollamaをインストール
Model Name → deepseek-r1:latest
Base URL → http://<ipアドレス>:11434
 ※ipアドレスはwsl上で"ip addr show eth0"を実行し出てきたipアドレス

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?