Open WebUI receives regular updates with new features and improvements. If you’ve installed it using the docker compose
method in my previous guide, updating is straightforward. This guide will walk you through creating a one-step update command that backs up your data first.
TL;DR
Create a one-line command customized to your setup that:
- Backs up your Open WebUI data
- Updates to the latest version
- Restarts everything automatically
Prerequisites
- Open WebUI already installed using Docker Compose
- Terminal access
- Basic knowledge of terminal commands (or you can just follow along) 😊
The One-Step Update Command
Here’s a single command that will every part of the upgrade. I’ll explain each part so you can customize it for your setup:
cd ~/Software/open-webui/ &&
mkdir -p backup &&
docker run --rm -v open-webui:/source -v "$(pwd)/backup":/backup alpine tar czf "/backup/$(date "+%Y-%m-%d.%H.%M")-open-webui-volume.tar.gz" -C /source . &&
docker stop open-webui &&
docker rm open-webui &&
docker pull ghcr.io/open-webui/open-webui:main &&
docker compose up -d
Understanding and Customizing the Command
Let’s break down what each part does and how to customize it:
Navigate to Your Open WebUI Directory
cd ~/Software/open-webui/
Customize this: Replace ~/Software/open-webui/
with the path to where you installed Open WebUI. Using the full path (like /Users/yourname/something/open-webui
) lets you run this command from any folder.
Create a Backup Directory
mkdir -p backup
This creates a backup directory inside your Open WebUI folder if it doesn’t already exist. The -p
flag prevents errors if the directory already exists.
Customize this: Change backup
to any name or location you prefer for storing your backups.
Back Up Your Data
docker run --rm -v open-webui:/source -v "$(pwd)/backup":/backup alpine tar czf "/backup/$(date "+%Y-%m-%d.%H.%M")-open-webui-volume.tar.gz" -C /source .
This part creates a timestamped backup of your Open WebUI data. Breaking it down:
--rm
: Removes the temporary container after backing up-v open-webui:/source
: Mounts your Open WebUI Docker volume to the container-v "$(pwd)/backup":/backup
: Mounts your local backup directory- The timestamp format
$(date "+%Y-%m-%d.%H.%M")
creates files like “2025-01-01.21.00-open-webui-volume.tar.gz”
Customize this: If your Docker volume has a different name than open-webui
, change it in this command.
Stop and Remove the Current Container
docker stop open-webui &&
docker rm open-webui
Customize this: If your container is named differently than open-webui
, update both instances.
Get the Latest Version and Restart
docker pull ghcr.io/open-webui/open-webui:main &&
docker compose up -d
This pulls the latest Open WebUI image and starts everything up again. The -d
flag runs it in detached mode (background).
Making Updates Even Easier
Once you’ve customized the command for your system, you can make it more accessible:
Option 1: Text Expansion
If you have a text expansion tool like TextExpander, Keyboard Maestro, Alfred’s Snippets, or macOS’s built-in text replacement, create a shortcut like :updatewebui
that expands to your full command.
Option 2: Create a Bash Alias
This is a more internal text expansion. Add this line to your ~/.zshrc
or ~/.bash_profile
file:
alias update-open-webui='your_entire_command_here'
After adding this, run source ~/.zshrc
(or source ~/.bash_profile
), and you can update Open WebUI simply by typing update-open-webui
in your terminal.
Option 3: Create a Shell Script (Most Flexible)
- Open Terminal and run:
cd ~/Software/open-webui/ # replace with your path
touch update-webui.sh
chmod +x update-webui.sh
- Edit the file with your preferred text editor and add:
#!/bin/bash
# Change to the Open WebUI directory
cd ~/Software/open-webui/ # replace with your path
# Create backup directory if it doesn't exist
mkdir -p backup
# Create a timestamped backup
docker run --rm -v open-webui:/source -v "$(pwd)/backup":/backup alpine tar czf "/backup/$(date "+%Y-%m-%d.%H.%M")-open-webui-volume.tar.gz" -C /source .
# Stop and remove the current container
docker stop open-webui
docker rm open-webui
# Pull the latest image
docker pull ghcr.io/open-webui/open-webui:main
# Start the updated container
docker compose up -d
echo "Open WebUI has been updated successfully!"
- Now you can update by running:
~/Software/open-webui/update-webui.sh
Troubleshooting
If you encounter any issues:
- Command not found: Make sure Docker and Docker Compose are installed.
- Permission denied: You might need to run the commands with
sudo
. - Can’t connect to Docker daemon: Make sure Docker Desktop is running.
- Backup fails: Check if you have enough disk space and proper permissions.
Conclusion
This command ensures your data is backed up before updating, allowing you to always restore your settings if needed.
Remember to adjust the filepaths in the command to match your specific installation. Once set up, updating Open WebUI becomes as simple as running a single command or using your text expansion shortcut.
Happy chatting with your updated Open WebUI!