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.

Note

In this section, the examples use a Docker instance called timescaledb. If you have given your Docker instance a different name, replace it when you issue the commands.

Try for free on Timescale

Timescale is a fully managed service with automatic backup and restore, high availability with replication, seamless scaling and resizing, and much more. You can try Timescale free for thirty days.

Try for free

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. Work out what type of mount your Docker container uses by running this command, which returns either volume or bind:

    docker inspect timescaledb --format='{{range .Mounts }}{{.Type}}{{end}}'
  2. Get the current name or mount path with this command, and record it to use when you perform the upgrade. Make sure you copy the correct command, based on your mount point type.

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.

  1. Pull the latest TimescaleDB image. This command pulls the image for PostgreSQL 14. If you're using another PostgreSQL version, look for the relevant tag in the TimescaleDB HA Docker Hub repository.

    docker pull timescale/timescaledb-ha:pg16
  2. Stop the old container, and remove it:

    docker stop timescaledb
    docker rm timescaledb
  3. Launch a new container with the upgraded Docker image, pointing to the existing mount point. Make sure you copy the correct command, based on your mount point type.

    For volume mounts:

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

    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;
  6. Update the TimescaleDB Toolkit extension. Toolkit is packaged with TimescaleDB's HA Docker image, and includes additional hyperfunctions to help you with queries and data analysis:

    CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit;
    ALTER EXTENSION timescaledb_toolkit UPDATE;
Note

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

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.