Local LLM Debugging: Launch Open WebUI with a Docker CLI Command
This article shows how to use the open-source Open WebUI project, started from the Docker CLI, as a local graphical debugging environment for large language model applications. It covers Docker prerequisites, configuring an OpenAI-compatible base URL and API key through an .env file, starting and checking the container, securing credentials, comparing Temperature, Max Tokens, and Top-P in the UI, troubleshooting common errors, and identifying the capabilities to add before moving from local testing to production.
In early large language model (LLM) application development, many developers call APIs directly with raw HTTP requests. This approach is inefficient when debugging complex prompts, testing multi-turn conversations, or comparing parameters such as Temperature and Max Tokens, because every change requires rewriting the request and inspecting raw JSON. A local debugging console with a graphical interface turns these operations into clicks and text input.
This article uses the open-source Open WebUI project as an example. It starts Open WebUI through the Docker CLI and connects it to an LLM service that is compatible with the OpenAI API format. The entire process requires only a terminal and a browser.
1. Prepare the Runtime Environment
Install Docker. Windows and macOS users can download Docker Desktop from the official Docker website, follow the installation wizard, and start Docker Desktop. Linux users can install Docker Engine through their distribution’s package manager.
Run the following two commands in a terminal to confirm that Docker is available:
docker --versiondocker info
docker --version should output a version number, for example Docker version 27.x.x. If docker info returns information normally, the background service is running. If it reports Cannot connect to the Docker daemon, start Docker Desktop or the Docker service first.
- Check three conditions:
- Disk space: the image and data volume together require several GB of free space.
- Port: this article uses local port 3000. On macOS or Linux, run
lsof -i :3000; on Windows, runnetstat -ano | findstr :3000to confirm whether the port is already in use. - Network: the local machine must be able to reach the API address of the model provider being used. On a corporate network, a proxy may need to be configured first.
2. Start the Debugging Container from the CLI
Find the Base URL for the OpenAI-compatible interface in the provider’s console documentation. It usually looks like
https://provider-domain/v1. This approach depends on that compatible format. If the provider only offers a proprietary protocol, a different debugging tool is required.Create a
.envfile in the working directory and add the following content:
# OpenAI-compatible address copied from the provider documentationOPENAI_API_BASE_URL=https://provider-domain/v1# API key created in the console; do not add spaces or quotes after the equals signOPENAI_API_KEY=
- Run the startup command:
docker run -d \--name llm-debug \--restart unless-stopped \-p 3000:8080 \--env-file .env \-v llm-debug-data:/app/backend/data \ghcr.io/open-webui/open-webui:main
The parameters work as follows. -d runs the container in the background. --name assigns a name to the container for easier management later. --restart unless-stopped automatically starts the container again after the machine restarts. -p 3000:8080 maps local port 3000 to port 8080 inside the container. --env-file reads variables from .env, so the key does not remain in shell history. -v saves conversation records and other data to a named volume, so the data remains after the container is deleted.
The main tag changes as the upstream project updates. To reproduce debugging results, find a fixed version number on the project’s GitHub Releases page and replace main with that version.
- Confirm the container status:
docker psdocker logs -f llm-debug
When the STATUS column in docker ps shows Up, the container is running. After the logs show that the service has started, press Ctrl+C to stop following the logs; the container continues to run in the background.
- Open http://localhost:3000 in a browser. On first use, you need to register an account. The first registered account is the administrator by default.
3. Obtain and Secure the API Key
Sign in to the provider console and create a new key on the API key management page. Give the key a name that indicates its purpose, such as
local-debug, so it is easy to distinguish later. Most platforms support usage limits or quota alerts; enable them during debugging when available.Do not put the key into command-line arguments, for example
docker run -e OPENAI_API_KEY=.... That approach stores the key in shell history, anddocker inspectcan also read it. Using a.envfile is safer.When handling the
.envfile, pay attention to the following three points:
- Add
.envto.gitignoreto avoid committing it to a code repository. - On Linux or macOS, run
chmod 600 .envso that only the current user can read and write it. - Do not paste the key into chat tools, tickets, or screenshots.
- If the key is leaked, handle it in the following order:
- Immediately delete or disable the key in the provider console.
- Create a new key and update
OPENAI_API_KEYin.env. - Run
docker rm -f llm-debugto delete the old container, then restart it with the command in section 2. The data volume is retained, so conversation records are not lost. - Check the usage billing for that key to confirm whether there are any abnormal calls.
After modifying .env, the interface may still use the old key. Open WebUI writes connection configuration to the data volume on first startup, and later environment variable changes may not take effect. In this case, an administrator can go to the backend connection settings and update the key directly. If you want .env to be fully authoritative, back up conversation records first, then delete the data volume and initialize again. Deleting the data volume clears all local data, so confirm before performing the operation.
4. Debug Models in the Interface
Go to the chat page and open the model selector at the top to view the model list. The list is usually fetched automatically from the provider’s model API. If the list is empty, check whether the Base URL includes
/v1and whether the key has permission to read the model list.After selecting a model, prepare a fixed set of test prompts. It is recommended to prepare 3 to 5 prompts covering different tasks such as summarization, rewriting, and reasoning. Change only one parameter at a time and compare results using the same set of prompts. If multiple parameters change at the same time, it is impossible to determine the cause of the change in results.
The following is an example set of parameter comparisons:
| Comparison group | Temperature | Max Tokens | Top-P | What to observe |
|---|---|---|---|---|
| A | 0.2 | 512 | 1.0 | Whether output is stable and follows the specified format |
| B | 0.9 | 512 | 1.0 | Whether wording is more varied and whether factual errors increase |
| C | 0.2 | 128 | 1.0 | Whether the answer is cut off midway |
| D | 0.2 | 512 | 0.5 | Whether the answer becomes more conservative after the candidate range is narrowed |
Temperature, Max Tokens, and Top-P are usually located in the advanced parameters of the chat settings panel. The location may differ slightly between versions; use the actual interface as the reference.
After each request, record latency, input and output token counts, and whether the answer stopped midway. If the provider offers usage statistics, compare them with the console billing. If the answer stops and the output length is close to Max Tokens, the limit is usually set too low.
When testing multi-turn conversations, first provide a specific piece of information, such as “My project codename is Atlas.” Then ask, “What is my project codename?” If the model answers correctly, context passing is working normally.
Different models have different default parameters and value ranges. After switching models, recheck the parameter values and use the provider documentation as the reference.
5. Troubleshoot Common Issues
| Symptom | Possible cause | What to do |
|---|---|---|
Bind for 0.0.0.0:3000 failed: port is already allocated |
Port 3000 is already in use | Run docker rm llm-debug to delete the failed container, change -p 3000:8080 to -p 3001:8080, restart, and visit port 3001 |
| The page does not open | The container is not running or failed to start | Run docker ps to check the status, then run docker logs llm-debug to view errors |
401 or Incorrect API key |
The key is wrong, has been deleted, or there is extra whitespace after the equals sign in .env |
Check the key against the console, remove extra whitespace, and handle configuration caching as described in section 3 |
404 Not Found |
The Base URL path is wrong, commonly because /v1 is missing |
Correct the address according to the provider documentation |
429 Too Many Requests |
Rate limiting has been triggered, or quota is insufficient | Reduce request frequency and check quota and rate limits in the console |
| Connection timeout or certificate error | The network is unreachable or the proxy configuration is incorrect | Test reachability of the Base URL on the host with curl -I, and configure a proxy as needed |
| A locally deployed model cannot be reached | localhost inside the container points to the container itself |
In Docker Desktop, use host.docker.internal instead of localhost. On Linux, add --add-host=host.docker.internal:host-gateway at startup |
6. From Local Debugging to an Online Service
A local container is suitable for validating prompts and parameters, but it cannot be used directly as a production environment. Before moving to the online stage, the following capabilities need to be added.
- Key management: production environments should use a cloud or self-hosted secret management service, assign separate keys by service, and rotate them regularly.
- Data storage: for retrieval-augmented generation (RAG), document corpora are usually stored in object storage. Major cloud providers offer such services; selection should consider compliance requirements, data location, and cost.
- Traffic peak shaving: when concurrent request volume is high, a message queue can buffer requests to avoid sudden traffic directly overwhelming the model API.
- Monitoring and logging: record call latency, token usage, and error codes. Logs should desensitize user input to avoid storing personal information or business data as-is. Alerts for 401 or 429 errors should reach the responsible person in a timely manner.
Parameter combinations and test sets accumulated during local debugging can be migrated directly to an online evaluation workflow to reduce repeated experimentation.
