> For the complete documentation index, see [llms.txt](https://docs.portainer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.portainer.io/faqs/upgrading/how-can-i-roll-back-to-a-previous-version-of-portainer.md).

# How can I roll back to a previous version of Portainer?

New versions of Portainer generally include a bump to the database schema version - this allows us to make changes to the database structure to accommodate new features, for example. As such, you're unable to use newer databases on older versions.

When updating Portainer we recommend [taking a backup](https://docs.portainer.io/admin/settings/general#back-up-portainer) first in case you need to roll back. You can then wipe your installation and [restore from the backup](https://docs.portainer.io/admin/settings/general#restoring-from-a-local-file) during reinstallation.

#### What if I don't have a backup?

If you didn't take a manual backup before updating, you can instead manually restore the database backup taken automatically during the update process. This is a backup of the `portainer.db` database only and is stored in the `portainer_data` volume, under the `backups` directory, named `portainer.db.bak`. You can use this backup to roll back to the previous version by doing the following:

1. Stop and remove your Portainer container (don't delete the `portainer_data` volume!)
2. Rename the existing `portainer.db` database in the base of the `portainer_data` directory to something like `portainer.db.oldversion` (just in case something goes wrong)
3. Copy the `backups/portainer.db.bak` file to `portainer.db` in the base of the `portainer_data` directory
4. Start Portainer using the image version you were *previously* on (this must match the version of the backed up database or Portainer will fail to start).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.portainer.io/faqs/upgrading/how-can-i-roll-back-to-a-previous-version-of-portainer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
