Previous Article
In my previous article, I summarized how to run Google's Gemma 4 locally using Ollama. While it feels great to have it running entirely locally, chatting from the terminal is honestly difficult. Conversation history isn't saved, and it's hard to copy and paste code.
That is why I introduced OpenWebUI. You can access the Ollama running on your host from a browser UI that looks just like ChatGPT. Furthermore, since you can also perform web searches via DuckDuckGo, you can complete a setup that allows you to "retrieve the latest information while remaining local."
In this article, I will summarize the steps to connect from OpenWebUI, launched via Docker, to the Ollama (Gemma 4) on the host. I will also record the points where you are likely to get stuck in a WSL2 environment.
Why use OpenWebUI?

The Ollama CLI is convenient, but it becomes insufficient as your usage grows.
Conversation history is not saved → It disappears the moment you close the terminal
Switching between multiple models is tedious → You have to re-enter commands
Cannot read Markdown → Code blocks and tables get garbled
Cannot perform web searches → Cannot retrieve the latest information
OpenWebUI solves all of these problems. If you have used ChatGPT before, you can keep the same UI experience while having "Gemma 4 under the hood."
Moreover, since everything runs locally, your internal company information or personal questions won't leave your machine. This was my primary motivation.
Configuration Overview
The configuration for this setup looks like this:
[ブラウザ] ↓ http://localhost:3001 [OpenWebUI(Dockerコンテナ)] ↓ http://<WSL2のIP>:11434 [Ollama(ホスト・systemctl管理)] ↓ [Gemma 4(gemma4-e2b-ja)]
The key point is that Ollama is running on the host side. Since you don't have to confine it within Docker, you can use the GPU directly, and those who already manage Ollama with systemctl can continue to use it as is.
To access the host's Ollama from the OpenWebUI side, you need the WSL2 IP address, and this is a point where you are likely to get stuck (described later).
About the Environment
The operating environment for this setup:
OS → Windows 11 + WSL2 (Ubuntu)
GPU → GTX 1070 (VRAM 8GB)
Docker → Docker Desktop (with WSL2 integration)
Ollama → Running on the host (set up in the previous article)
Model → gemma4-e2b-ja
I wrote about how to set up Ollama and create the gemma4-e2b-ja model in the previous article. If you haven't done that yet, please finish it before proceeding.
Prerequisite: Ollama must be running
Before starting OpenWebUI, check if Ollama is running on the host side.
systemctl status ollama
If it is stopped, start it:
sudo systemctl start ollama
Also, check the models:
ollama list | grep gemma4
If gemma4-e2b-ja appears, you are good to go.
Create docker-compose.yml
Prepare a project directory and place docker-compose.yml there.
services:
open-webui:
image: ghcr.io/open-webui/open-webui:latest
container_name: openwebui
ports:
- "3001:8080"
environment:
# ホストで起動しているOllamaを使用(WSL2ゲートウェイ)
- OLLAMA_BASE_URL=http://$OLLAMA_HOST_IP:$OLLAMA_PORT
volumes:
# OpenWebUIのデータ(設定・DB)はバインドマウント
- ./data/openwebui:/app/backend/data
networks:
- webui-net
networks:
webui-net:There are two key points:
Pass OLLAMA_BASE_URL as an environment variable → If the IP changes, you only need to update the .env file.
Bind mount the data → Settings and the database are saved in ./data/openwebui, so your conversation history won't be lost even if you recreate the container.
I set the port to 3001:8080. The default for OpenWebUI is 8080, but since that often conflicts with other services, I shifted the external port to 3001.
Create .env (this is a common pitfall)
In a WSL2 environment, when accessing the host from a container, you must explicitly specify the host's IP address. localhost will not work, and host.docker.internal may not work depending on the environment.
The most reliable method is to specify the WSL2 IP address directly.
Check the IP:
hostname -I
Multiple IPs will appear, but use the first IP.
172.xx.xx.xx 172.17.0.1 172.18.0.1
In this case, 172.xx.xx.xx is the IP address of the WSL2 side.
Create a .env file:
OLLAMA_HOST_IP=172.xx.xx.xx OLLAMA_PORT=11434
The $OLLAMA_HOST_IP in docker-compose.yml is loaded from here.
Note: The IP address may change when you restart WSL2. In that case, you need to update the .env file and restart the container. This is slightly tedious, so I have written a workaround in the troubleshooting section below.
Start the container
Once you have prepared everything up to this point, start it:
docker compose up -d
Use -d to run in the background. Check that it has started:
docker compose ps
If it displays as follows, you are good to go:
CONTAINER ID IMAGE STATUS xxxxxxxx ghcr.io/open-webui/open-webui:latest Up X seconds
Open http://localhost:3001 in your browser. If the OpenWebUI login screen appears, you have succeeded.
You will need to register an account on your first access. This is a local registration, and no data is sent externally, so feel free to enter your email address and password to proceed. The first account you register will become the administrator.
Verify the Ollama connection
Once you are logged in, check if Gemma 4 is visible.
Icon in the top right → Settings → Connections
Ollama API Base URL should contain the IP you set in the .env file:
http://172.xx.xx.xx:11434
If a green checkmark appears during the connection test, you have succeeded
Once the connection is successful, models like gemma4-e2b-ja will appear in the model selection dropdown at the top of the chat screen. You can select one to start chatting.
Enable Web Search (DDGS)
Web search is disabled by default in OpenWebUI. You must enable it manually.
Settings → Web Search
Enable Web Search to ON
WEB Search Engine Select DDGS (DuckDuckGo Search)
DDGS Backend can be left as auto
Save settings
This will make a "WEB Search" toggle appear in the chat input field. If you turn this ON when asking a question, it will return an answer based on DuckDuckGo search results.
The reason for choosing DDGS is that it works without an API key. You can also connect Google or Bing search, but each requires obtaining an API key. If you just want to try out search, DDGS is the easiest.
Turning OFF Thinking Mode
Gemma 4 has an "Extended Thinking Mode" that outputs the thought process. While it improves the quality of the answer, it slows down the response time. You can turn it OFF if you want to prioritize speed.
Open the Controls in the top right of the chat screen
Advanced Parameters Select
think (Ollama) Turn OFF
With just this, the next chat will skip the thought process and return an answer. It is recommended to use this selectively depending on the content of the conversation.
Impressions after using it
If you are used to the ChatGPT UI, you can use this without any discomfort. It has everything you need, such as Markdown rendering, a copy button for code blocks, and a left sidebar for conversation history.
The response of Gemma 4 e2b is hard to call comfortable even with thinking mode turned off. On a GTX 1070, there are quite a few moments where you have to wait for a response. The impression might change in an environment with more specs, but honestly, I couldn't say it "runs smoothly" on this GPU.
I tried DDGS (DuckDuckGo) for web search, but the search accuracy wasn't that high. If you want accuracy, it might be more realistic to obtain an API key and connect Google or Bing.
Troubleshooting
The container starts but cannot connect to OllamaThis is the easiest place to get stuck. Most of the causes are a mismatch in the IP address.
Verification steps:
# 現在のWSL2 IPを確認 hostname -I .envに書いたIPと一致しているか確認 cat .env コンテナの中からOllamaに到達できるかテスト docker exec openwebui curl -s http://<OLLAMA_HOST_IP>:11434/api/tags | head -20
If JSON is returned by the last command, the connection is established. If it is not returned, the IP is incorrect or Ollama is not running.
If the IP is incorrect, update the .env file and restart:
docker compose down && docker compose up -d
Check the logs:
docker compose logs
Port 3001 is often already in use. In that case, change the port number in docker-compose.yml.
I want to delete/initialize conversation historyYou can perform a complete reset by deleting the volume:
docker compose down -v
If you also want to delete the ./data/openwebui directory, remove it manually.
Operational Tips
Things I noticed after starting to use OpenWebUI:
Register multiple models → If you prepare multiple models in Ollama, you can easily compare them by just switching from the dropdown menu in OpenWebUI
Back up ./data/openwebui regularly → All conversation history and prompt templates are stored here
Restart after adding a new model to Ollama → Run docker compose restart to update the cache on the OpenWebUI side
Summary
By installing OpenWebUI, the usability of my local LLM environment has clearly improved.
Compared to when I had to type commands in the CLI every time, conversation history is now saved, and switching models is done with a single dropdown.
In terms of "setting up an environment," I believe this is a milestone.
Web search has limitations in accuracy with DDGS, but the UI itself is highly polished.
Response speed depends on GPU specs, so with a GTX 1070 class card, there are times when it is not entirely stress-free.
Even so, the foundation of "running locally," "no subscription fees," and "saving conversation history" is established, so it is worth trying out.