Open WebUI is a fantastic, self-hosted frontend for various AI models. If you’re running it in Docker (and you probably are!), keeping it up-to-date is crucial for accessing the latest features, bug fixes, and performance improvements. This post will walk you through two simple methods to update your Open WebUI Docker container.
Method 1: Manual Update
This method involves a straightforward sequence of Docker commands. It’s a good option if you prefer more control over the update process.
1. Pull the latest image: This downloads the newest Open WebUI image from the container registry.
docker pull ghcr.io/open-webui/open-webui:main
2. Stop the current container: This gracefully shuts down your running Open WebUI container.
docker stop open-webui
3. Remove the old container: This deletes the old container, freeing up resources.
docker rm open-webui
4. Start the updated container: This launches a new container using the latest image, with your existing data preserved. **Important:** Pay attention to the volume mount (`-v`) to ensure your data is not lost!
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
Code info:
`-d`: Runs the container in detached mode (in the background).
`-p 3000:8080`: Maps port 3000 on your host machine to port 8080 inside the container (Open WebUI’s default port). Adjust the host port (3000) if needed.
`–add-host=host.docker.internal:host-gateway`: This is often necessary for accessing services running on your host machine from within the container.
`-v open-webui:/app/backend/data`: This mounts a volume named `open-webui` to the `/app/backend/data` directory inside the container. **This is where your Open WebUI data is stored!** Make sure you’ve created this volume (e.g., `docker volume create open-webui`) or that the directory on your host machine exists and has the correct permissions.
`–name open-webui`: Assigns a name to the container for easy management.
`–restart always`: Automatically restarts the container if it crashes or the system reboots.
Method 2: File BAT for Windows
Just copy paste in a txt file and save it as bat file format:
@echo off echo Pulling latest image... docker pull ghcr.io/open-webui/open-webui:main timeout /t 5 /nobreak > nul echo Stopping container... docker stop open-webui timeout /t 5 /nobreak > nul echo Removing container... docker rm open-webui timeout /t 5 /nobreak > nul echo Starting updated container... docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main echo Update complete!Visit https://Davebyday.com for more info! pause
Method 3: Automated Updates Using Watchtower
Want to keep your Open WebUI container always up-to-date with minimal effort?
Watchtower is a fantastic tool that automatically monitors your running containers and updates them when new images are available.
To set it up:
docker run -d --name watchtower --restart always -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower open-webui
`-d`: Runs Watchtower in detached mode.
`–name watchtower`: Assigns a name to the Watchtower container.
`–restart always`: Restarts Watchtower automatically.
`-v /var/run/docker.sock:/var/run/docker.sock`: Mounts the Docker socket, allowing Watchtower to communicate with the Docker daemon.
`open-webui`: Specifies the container to monitor and update.
By default, Watchtower checks for updates every 24 hours. You can customize this interval using environment variables (see the Watchtower documentation for details: https://containrrr.dev/watchtower
Updating Open WebUI in Docker is a breeze with either of these methods. The manual approach gives you full control, while Watchtower provides a hands-off, automated solution. Choose the method that best suits your needs and enjoy the latest features and improvements in Open WebUI!