---
title: Upgrade TimescaleDB running in Docker | Tiger Data Docs
description: Upgrade self-hosted TimescaleDB running in a Docker container to a new minor version
---

If you originally installed TimescaleDB using Docker, you can upgrade from within the Docker container. This allows you to upgrade to the latest TimescaleDB version while retaining your data.

The `timescale/timescaledb-ha*` images have the files necessary to run previous versions. Patch releases only contain bugfixes so should always be safe. Non-patch releases may rarely require some extra steps. These steps are mentioned in the [release notes](https://github.com/timescale/timescaledb/releases) for the version of TimescaleDB that you are upgrading to.

After you upgrade the docker image, you run `ALTER EXTENSION` for all databases using TimescaleDB.

The examples in this page use a Docker instance called `timescaledb`. If you have given your Docker instance a different name, replace it when you issue the commands.

## Determine the mount point type

When you start your upgraded Docker container, you need to be able to point the new Docker image to the location that contains the data from your previous version. To do this, you need to work out where the current mount point is. The current mount point varies depending on whether your container is using volume mounts, or bind mounts.

1. **Find the mount type used by your Docker container**

   Terminal window

   ```
   docker inspect timescaledb --format='{{range .Mounts }}{{.Type}}{{end}}'
   ```

   This returns either `volume` or `bind`.

2. **Note the volume or bind used by your container**

   - [Volume](#tab-panel-482)
   - [Bind](#tab-panel-483)

   Terminal window

   ```
   docker inspect timescaledb --format='{{range .Mounts }}{{.Name}}{{end}}'
   ```

   Docker returns the `<volume ID>`. You see something like this:

   ```
   069ba64815f0c26783b81a5f0ca813227fde8491f429cf77ed9a5ae3536c0b2c
   ```

   Terminal window

   ```
   docker inspect timescaledb --format='{{range .Mounts }}{{.Source}}{{end}}'
   ```

   Docker returns the `<bind path>`. You see something like this:

   ```
   /path/to/data
   ```

   You use this value when you perform the upgrade.

## Upgrade TimescaleDB within Docker

To upgrade TimescaleDB within Docker, you need to download the upgraded image, stop the old container, and launch the new container pointing to your existing data.

- [TimescaleDB-HA](#tab-panel-488)
- [TimescaleDB light](#tab-panel-489)

1. **Pull the latest TimescaleDB image**

   This command pulls the latest version of TimescaleDB running on PostgreSQL 18:

   ```
   docker pull timescale/timescaledb-ha:pg18
   ```

   If you’re using another version of PostgreSQL, look for the relevant tag in the [TimescaleDB HA](https://hub.docker.com/r/timescale/timescaledb-ha/tags) repository on Docker Hub.

2. **Stop the old container, and remove it**

   Terminal window

   ```
   docker stop timescaledb
   docker rm timescaledb
   ```

3. **Launch a new container with the upgraded Docker image**

   Launch based on your mount point type:

   - [Volume mount](#tab-panel-484)
   - [Bind mount](#tab-panel-485)

   Terminal window

   ```
   docker run -v <volume ID>:/pgdata -e PGDATA=/pgdata
     -d --name timescaledb -p 5432:5432 timescale/timescaledb-ha:pg18
   ```

   Terminal window

   ```
   docker run -v <bind path>:/pgdata -e PGDATA=/pgdata -d --name timescaledb \
     -p 5432:5432 timescale/timescaledb-ha:pg18
   ```

4. **Connect to the upgraded instance using psql with the -X flag**

   Terminal window

   ```
   docker exec -it timescaledb psql -U postgres -X
   ```

5. **At the `psql` prompt, use the `ALTER` command to upgrade the extension**

   ```
   ALTER EXTENSION timescaledb UPDATE;
   CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit;
   ALTER EXTENSION timescaledb_toolkit UPDATE;
   ```

   The [TimescaleDB Toolkit](/docs/deploy/self-hosted/tooling/install-toolkit/index.md) extension is packaged with TimescaleDB HA, it includes additional hyperfunctions to help you with queries and data analysis.

   Note

   If you have multiple databases, update each database separately.

1) **Pull the latest TimescaleDB image**

   This command pulls the latest version of TimescaleDB running on PostgreSQL 18.

   ```
   docker pull timescale/timescaledb:latest-pg18
   ```

   If you’re using another version of PostgreSQL, look for the relevant tag in the [TimescaleDB light](https://hub.docker.com/r/timescale/timescaledb) repository on Docker Hub.

2) **Stop the old container, and remove it**

   Terminal window

   ```
   docker stop timescaledb
   docker rm timescaledb
   ```

3) **Launch a new container with the upgraded Docker image**

   Launch based on your mount point type:

   - [Volume mount](#tab-panel-486)
   - [Bind mount](#tab-panel-487)

   Terminal window

   ```
   docker run -v  <volume ID>:/pgdata -e PGDATA=/pgdata \
     -d --name timescaledb -p 5432:5432 timescale/timescaledb:latest-pg18
   ```

   Terminal window

   ```
   docker run -v <bind path>:/pgdata -e PGDATA=/pgdata -d --name timescaledb \
     -p 5432:5432 timescale/timescaledb:latest-pg18
   ```

4) **Connect to the upgraded instance using psql with the -X flag**

   Terminal window

   ```
   docker exec -it timescaledb psql -U postgres -X
   ```

5) **At the `psql` prompt, use the `ALTER` command to upgrade the extension**

   ```
   ALTER EXTENSION timescaledb UPDATE;
   ```

   Note

   If you have multiple databases, you need to update each database separately.
