Post

Update OpenWebUI with One Shell Function

Quickly update your local OpenWebUI Docker container with a reusable shell function.

Update OpenWebUI with One Shell Function

I started using OpenWebUI to chat with multiple LLMs at once and store all the generated data locally instead of across multiple providers. So far, it works damn well.

Here’s a quick tip to easily update OpenWebUI without fetching the source or losing your chat history. This one-liner shell function does everything:

1
2
3
4
5
6
7
8
updateOpenWebUI() {
  docker rm -f open-webui
  docker pull ghcr.io/open-webui/open-webui:main
  docker run -d -p 3000:8080 \
    -v open-webui:/app/backend/data \
    --name open-webui \
    ghcr.io/open-webui/open-webui:main
}

🔁 What It Does

  • Stops and removes the current container (data volume untouched)
  • Pulls the latest OpenWebUI image
  • Runs a new container using the existing volume for persistent data

Optional: Add a Secret Key

If you’re getting logged out after updates, define a persistent WEBUI_SECRET_KEY:

1
2
3
4
5
docker run -d -p 3000:8080 \
  -v open-webui:/app/backend/data \
  --name open-webui \
  -e WEBUI_SECRET_KEY=your_secret_key \
  ghcr.io/open-webui/open-webui:main

Automate It with Watchtower

To auto-update OpenWebUI:

1
2
3
docker run -d --name watchtower \
  -v /var/run/docker.sock:/var/run/docker.sock \
  containrrr/watchtower -i 300 open-webui

This checks for updates every 5 minutes.

View or Inspect Data

Your data is stored in a Docker volume:

1
docker volume inspect open-webui

Linux mount point:

1
/var/lib/docker/volumes/open-webui/_data

Windows (WSL2) paths:

1
\\wsl$\docker-desktop\mnt\docker-desktop-disk\data\docker\volumes

That’s it. Bookmark this shell function and never worry about manual updates again.

☕ Support My Work

If you found this post helpful and want to support more content like this, you can buy me a coffee!

Your support helps me continue creating useful articles and tips for fellow developers. Thank you! 🙏

This post is licensed under CC BY 4.0 by the author.