From cabf67a3a074b0545255ad1de3e580c56788f149 Mon Sep 17 00:00:00 2001 From: Iain Date: Mon, 30 Jun 2025 17:14:33 +0200 Subject: [PATCH 01/12] chore: first go. --- .../_install-self-hosted-docker-based.mdx | 116 ++++++++++++------ _partials/_prometheus-integrate.md | 2 +- self-hosted/upgrades/upgrade-docker.md | 105 ++++++++++------ 3 files changed, 146 insertions(+), 77 deletions(-) diff --git a/_partials/_install-self-hosted-docker-based.mdx b/_partials/_install-self-hosted-docker-based.mdx index 62bf1ebc4e..7daeac8efd 100644 --- a/_partials/_install-self-hosted-docker-based.mdx +++ b/_partials/_install-self-hosted-docker-based.mdx @@ -1,59 +1,103 @@ + In Terminal: 1. **Run the $TIMESCALE_DB Docker image** - The [TimescaleDB HA](https://hub.docker.com/r/timescale/timescaledb-ha) Docker image offers the most complete $TIMESCALE_DB experience. It uses [Ubuntu][ubuntu], includes [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit), and support for PostGIS and Patroni. The latest release based on PostgreSQL 17 is `timescale/timescaledb-ha:pg17`: + The [$TIMESCALE_DB HA](https://hub.docker.com/r/timescale/timescaledb-ha) Docker image offers the most complete + $TIMESCALE_DB experience. It uses [Ubuntu][ubuntu], includes + [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit), and support for PostGIS and Patroni. + The lighter-weight [TimescaleDB](https://hub.docker.com/r/timescale/timescaledb) non-ha Docker image uses + [Alpine][alpine]. + + To install the latest release based on PostgreSQL 17: + + + + + + docker pull timescale/timescaledb-ha:pg17 + + + + - ```bash - docker pull timescale/timescaledb-ha:pg17 - ``` + docker pull timescale/timescaledb:latest-pg17 - The lighter-weight [TimescaleDB](https://hub.docker.com/r/timescale/timescaledb) non-ha Docker image uses [Alpine][alpine]. The latest release based on PostgreSQL 17 is `timescale/timescaledb:latest-pg17`. + - $TIMESCALE_DB is pre-created in the default PostgreSQL database in both the -ha and non-ha Docker images. - By default, $TIMESCALE_DB is added to any new database you create in these images. + + + $TIMESCALE_DB is pre-created in the default PostgreSQL database in both the -ha and non-ha Docker images. + By default, $TIMESCALE_DB is added to any new database you create in these images. 1. **Run the container** - ```bash - docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 - ``` + + + + + docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 + + + + + + docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 - If you are running multiple container instances remember to change the port each Docker instance runs on. + - On UNIX based systems, Docker modifies Linux IP tables to bind the container. If your system uses - Linux Uncomplicated Firewall (UFW), Docker may - [override your UFW port binding settings](https://www.techrepublic.com/article/how-to-fix-the-docker-and-ufw-security-flaw/). - To prevent this, add `DOCKER_OPTS="--iptables=false"` to `/etc/default/docker`. + + + If you are running multiple container instances remember to change the port each Docker instance runs on. + + On UNIX based systems, Docker modifies Linux IP tables to bind the container. If your system uses + Linux Uncomplicated Firewall (UFW), Docker may + [override your UFW port binding settings](https://www.techrepublic.com/article/how-to-fix-the-docker-and-ufw-security-flaw/). + To prevent this, add `DOCKER_OPTS="--iptables=false"` to `/etc/default/docker`. 1. **Connect to a database on your PostgreSQL instance** - ```bash - psql -d "postgres://postgres:password@localhost/postgres" - ``` + ```bash + psql -d "postgres://postgres:password@localhost/postgres" + ``` - The default user and database are both `postgres`. You set the password in - `POSTGRES_PASSWORD` in the previous step. The default command to connect to PostgreSQL in this image is: + The default user and database are both `postgres`. You set the password in + `POSTGRES_PASSWORD` in the previous step. The default command to connect to PostgreSQL in this image is: 1. **Check that $TIMESCALE_DB is installed** - ```sql - \dx - ``` - - You see the list of installed extensions: - - ```sql - List of installed extensions - Name | Version | Schema | Description - ---------------------+---------+------------+--------------------------------------------------------------------------------------- - plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language - timescaledb | 2.17.2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) - timescaledb_toolkit | 1.19.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities - (3 rows) - ``` - Press q to exit the list of extensions. + ```sql + \dx + ``` + + You see the list of installed extensions: + + + + + + Name | Version | Schema | Description + ---------------------+---------+------------+--------------------------------------------------------------------------------------- + plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language + timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) + timescaledb_toolkit | 1.19.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities + (3 rows) + + + + + + Name | Version | Schema | Description + ---------------------+---------+------------+--------------------------------------------------------------------------------------- + plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language + timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) + + + + + + Press q to exit the list of extensions. diff --git a/_partials/_prometheus-integrate.md b/_partials/_prometheus-integrate.md index f2cc3480a5..06189a5d23 100644 --- a/_partials/_prometheus-integrate.md +++ b/_partials/_prometheus-integrate.md @@ -211,4 +211,4 @@ You can further [visualize your data][grafana-prometheus] with Grafana. Use the [enable-timescaledb]: /self-hosted/:currentVersion:/install/ [prometheus-authentication]: https://prometheus.io/docs/guides/basic-auth/ [scrape-targets]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config -[pricing-plan-features]: /about/:currentVersion:/pricing-and-account-management/#features-included-in-each-plan \ No newline at end of file +[pricing-plan-features]: /about/:currentVersion:/pricing-and-account-management/#features-included-in-each-plan diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index aaa1c4eef4..d8feb22fe9 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -7,17 +7,17 @@ keywords: [upgrades, Docker] import ConsiderCloud from "versionContent/_partials/_consider-cloud.mdx"; -# Upgrade TimescaleDB running in Docker +# Upgrade $TIMESCALE_DB running in Docker -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. +If you originally installed $TIMESCALE_DB using Docker, you can upgrade from within the Docker +container. This allows you to upgrade to the latest $TIMESCALE_DB 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][relnotes] for the version of TimescaleDB +These steps are mentioned in the [release notes][relnotes] for the version of $TIMESCALE_DB that you are upgrading to. -After you upgrade the docker image, you run `ALTER EXTENSION` for all databases using TimescaleDB. +After you upgrade the docker image, you run `ALTER EXTENSION` for all databases using $TIMESCALE_DB. @@ -35,34 +35,34 @@ mounts, or bind mounts. -### Determining the mount point type - -1. Work out what type of mount your Docker container uses by running this - command, which returns either `volume` or `bind`: +1. Find the mount type used by your Docker container: ```bash docker inspect timescaledb --format='{{range .Mounts }}{{.Type}}{{end}}' ``` + This returns either `volume` or `bind`. -1. 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. +1. Note the volume or bind used by your container. - + ```bash docker inspect timescaledb --format='{{range .Mounts }}{{.Name}}{{end}}' + + You see something like this: 069ba64815f0c26783b81a5f0ca813227fde8491f429cf77ed9a5ae3536c0b2c ``` - + ```bash docker inspect timescaledb --format='{{range .Mounts }}{{.Source}}{{end}}' + + You see something like this: /path/to/data ``` @@ -70,26 +70,41 @@ mounts, or bind mounts. + You use this value when you perform the upgrade. + -## Upgrade TimescaleDB within Docker +## Upgrade $TIMESCALE_DB within Docker -To upgrade TimescaleDB within Docker, you need to download the upgraded image, +To upgrade $TIMESCALE_DB within Docker, you need to download the upgraded image, stop the old container, and launch the new container pointing to your existing data. -### Upgrading TimescaleDB within Docker +1. Pull the latest $TIMESCALE_DB image. -1. Pull the latest TimescaleDB image. This command pulls the image for - TimescaleDB 2.17.x running on PostgreSQL 17. If you're using another PostgreSQL version, - look for the relevant tag in the - [TimescaleDB HA Docker Hub repository](https://hub.docker.com/r/timescale/timescaledb-ha/tags). + This command pulls the latest version of $TIMESCALE_DB running on $PG 17. - ```bash - docker pull timescale/timescaledb-ha:pg17 - ``` + + + + + docker pull timescale/timescaledb-ha:pg17 + + + + + + docker pull timescale/timescaledb:latest-pg17 + + + + + + If you're using another version of $PG, look for the relevant tag in the + [$TIMESCALE_DB HA](https://hub.docker.com/r/timescale/timescaledb-ha/tags) or + [TimescaleDB light](https://hub.docker.com/r/timescale/timescaledb) repositories on Docker Hub. 1. Stop the old container, and remove it: @@ -98,18 +113,20 @@ data. docker rm timescaledb ``` -1. 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. +1. Launch a new container with the upgraded Docker image: - For volume mounts: + The containers store the $PG `` in the following locations: + - timescaledb-ha:`/home/postgres/pgdata/data` + - timescaledb: `/var/lib/postgresql/data` + + Update the following command, based on your mount point type to point to the correct data folder: ```bash - docker run -v 069ba64815f0c26783b81a5f0ca813227fde8491f429cf77ed9a5ae3536c0b2c:/var/lib/postgresql/data \ + docker run -v <>: \ -d --name timescaledb -p 5432:5432 timescale/timescaledb-ha ``` @@ -118,13 +135,15 @@ data. ```bash - docker run -v /path/to/data:/var/lib/postgresql/data -d --name timescaledb \ + docker run -v /bind/path/recovered/earlier: -d --name timescaledb \ -p 5432:5432 timescale/timescaledb-ha ``` + + If you are running $TIMESCALE_DB light, update the command to run `timescale/timescaledb`. 1. Connect to the upgraded instance using `psql` with the `-X` flag: @@ -134,18 +153,24 @@ data. 1. At the psql prompt, use the `ALTER` command to upgrade the extension: - ```sql - ALTER EXTENSION timescaledb UPDATE; - ``` + -1. Update the [$TOOLKIT_LONG][toolkit] extension. $TOOLKIT_SHORT is packaged - with TimescaleDB's HA Docker image, and includes additional hyperfunctions - to help you with queries and data analysis: + - ```sql - CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit; - ALTER EXTENSION timescaledb_toolkit UPDATE; - ``` + ALTER EXTENSION timescaledb UPDATE; + CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit; + ALTER EXTENSION timescaledb_toolkit UPDATE; + + + + + ALTER EXTENSION timescaledb UPDATE; + + + + + The [$TOOLKIT_LONG][toolkit] extension is packaged with $TIMESCALE_DB HA, it includes additional + hyperfunctions to help you with queries and data analysis: If you have multiple databases, you need to update each database separately. From db032b5dc56df3e840385bb38007e4d7cba61c59 Mon Sep 17 00:00:00 2001 From: atovpeko Date: Tue, 1 Jul 2025 14:55:30 +0300 Subject: [PATCH 02/12] tabs --- .../_install-self-hosted-docker-based.mdx | 261 ++++++++++++++---- self-hosted/install/installation-docker.md | 89 +----- self-hosted/upgrades/upgrade-docker.md | 131 ++++++--- 3 files changed, 298 insertions(+), 183 deletions(-) diff --git a/_partials/_install-self-hosted-docker-based.mdx b/_partials/_install-self-hosted-docker-based.mdx index 7daeac8efd..9ae236c7f3 100644 --- a/_partials/_install-self-hosted-docker-based.mdx +++ b/_partials/_install-self-hosted-docker-based.mdx @@ -1,106 +1,255 @@ - + + + -In Terminal: + 1. **Run the $TIMESCALE_DB Docker image** The [$TIMESCALE_DB HA](https://hub.docker.com/r/timescale/timescaledb-ha) Docker image offers the most complete $TIMESCALE_DB experience. It uses [Ubuntu][ubuntu], includes [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit), and support for PostGIS and Patroni. - The lighter-weight [TimescaleDB](https://hub.docker.com/r/timescale/timescaledb) non-ha Docker image uses - [Alpine][alpine]. - To install the latest release based on PostgreSQL 17: + To install the latest release based on PostgreSQL 17: - + ``` + docker pull timescale/timescaledb-ha:pg17 + ``` - + $TIMESCALE_DB is pre-created in the default $PG database and is added by default to any new database you create in this image. - docker pull timescale/timescaledb-ha:pg17 +1. **Run the container** - + ``` + docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 + ``` - + If you are running multiple container instances, change the port each Docker instance runs on. - docker pull timescale/timescaledb:latest-pg17 + On UNIX-based systems, Docker modifies Linux IP tables to bind the container. If your system uses Linux Uncomplicated Firewall (UFW), Docker may + [override your UFW port binding settings][override-binding]. To prevent this, add `DOCKER_OPTS="--iptables=false"` to `/etc/default/docker`. - +1. **Connect to a database on your $PG instance** - + The default user and database are both `postgres`. You set the password in `POSTGRES_PASSWORD` in the previous step. The default command to connect to $PG in this image is: + + ```bash + psql -d "postgres://postgres:password@localhost/postgres" + ``` + +1. **Check that $TIMESCALE_DB is installed** - $TIMESCALE_DB is pre-created in the default PostgreSQL database in both the -ha and non-ha Docker images. - By default, $TIMESCALE_DB is added to any new database you create in these images. + ```sql + \dx + ``` + + You see the list of installed extensions: + + ```sql + Name | Version | Schema | Description + ---------------------+---------+------------+--------------------------------------------------------------------------------------- + plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language + timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) + timescaledb_toolkit | 1.19.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities + (3 rows) + ``` + + Press `q` to exit the list of extensions. + + -1. **Run the container** +## More Docker options - +If you want to run the image directly from the container, you can use this +command: - +```bash +docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 +``` - docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 +The `-p` flag binds the container port to the host port. This means that +anything that can access the host port can also access your $TIMESCALE_DB container, +so it's important that you set a $PG password using the +`POSTGRES_PASSWORD` environment variable. Without that variable, the Docker +container disables password checks for all database users. - +If you want to access the container from the host but avoid exposing it to the +outside world, you can bind to `127.0.0.1` instead of the public interface, using this command: - +```bash +docker run -d --name timescaledb -p 127.0.0.1:5432:5432 \ +-e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 +``` - docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 +If you don't want to install `psql` and other $PG client tools locally, +or if you are using a Microsoft Windows host system, you can connect using the +version of `psql` that is bundled within the container with this command: - +```bash +docker exec -it timescaledb psql -U postgres +``` - +Existing containers can be stopped using `docker stop` and started again with +`docker start` while retaining their volumes and data. When you create a new +container using the `docker run` command, by default you also create a new data +volume. When you remove a Docker container with `docker rm`, the data volume +persists on disk until you explicitly delete it. You can use the `docker volume +ls` command to list existing docker volumes. If you want to store the data from +your Docker container in a host directory, or you want to run the Docker image +on top of an existing data directory, you can specify the directory to mount a +data volume using the `-v` flag: - If you are running multiple container instances remember to change the port each Docker instance runs on. +```bash +docker run -d --name timescaledb -p 5432:5432 \ +-v /your/data/dir:/home/postgres/pgdata/data \ +-e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 +``` + +When you install $TIMESCALE_DB using a Docker container, the $PG settings +are inherited from the container. In most cases, you do not need to adjust them. +However, if you need to change a setting, you can add `-c setting=value` to your +Docker `run` command. For more information, see the +[Docker documentation][docker-postgres]. + +The link provided in these instructions is for the latest version of $TIMESCALE_DB +on $PG 16. To find other Docker tags you can use, see the [Dockerhub repository][dockerhub]. + +## View logs in Docker + +If you have $TIMESCALE_DB installed in a Docker container, you can view your logs +using Docker, instead of looking in `/var/lib/logs` or `/var/logs`. For more +information, see the [Docker documentation on logs][docker-logs]. + + + + + + + +1. **Run the $TIMESCALE_DB Docker image** - On UNIX based systems, Docker modifies Linux IP tables to bind the container. If your system uses - Linux Uncomplicated Firewall (UFW), Docker may - [override your UFW port binding settings](https://www.techrepublic.com/article/how-to-fix-the-docker-and-ufw-security-flaw/). - To prevent this, add `DOCKER_OPTS="--iptables=false"` to `/etc/default/docker`. + The light-weight [TimescaleDB](https://hub.docker.com/r/timescale/timescaledb) Docker image uses [Alpine][alpine] and does not contain [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit) or support for PostGIS and Patroni. -1. **Connect to a database on your PostgreSQL instance** + To install the latest release based on $PG 17: - ```bash - psql -d "postgres://postgres:password@localhost/postgres" - ``` + ``` + docker pull timescale/timescaledb:latest-pg17 + ``` - The default user and database are both `postgres`. You set the password in - `POSTGRES_PASSWORD` in the previous step. The default command to connect to PostgreSQL in this image is: + $TIMESCALE_DB is pre-created in the default $PG database and added by default to any new database you create in this image. + + +1. **Run the container** + + ``` + docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 + ``` + + If you are running multiple container instances, change the port each Docker instance runs on. + + On UNIX-based systems, Docker modifies Linux IP tables to bind the container. If your system uses Linux Uncomplicated Firewall (UFW), Docker may [override your UFW port binding settings][override-binding]. To prevent this, add `DOCKER_OPTS="--iptables=false"` to `/etc/default/docker`. + +1. **Connect to a database on your $PG instance** + + The default user and database are both `postgres`. You set the password in `POSTGRES_PASSWORD` in the previous step. The default command to connect to $PG in this image is: + + ```bash + psql -d "postgres://postgres:password@localhost/postgres" + ``` 1. **Check that $TIMESCALE_DB is installed** - ```sql - \dx - ``` + ```sql + \dx + ``` + + You see the list of installed extensions: + + ```sql + Name | Version | Schema | Description + ---------------------+---------+------------+--------------------------------------------------------------------------------------- + plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language + timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) + ``` - You see the list of installed extensions: + Press `q` to exit the list of extensions. - +## More Docker options - +If you want to run the image directly from the container, you can use this +command: - Name | Version | Schema | Description - ---------------------+---------+------------+--------------------------------------------------------------------------------------- - plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language - timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) - timescaledb_toolkit | 1.19.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities - (3 rows) +```bash +docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 +``` - +The `-p` flag binds the container port to the host port. This means that +anything that can access the host port can also access your $TIMESCALE_DB container, +so it's important that you set a $PG password using the +`POSTGRES_PASSWORD` environment variable. Without that variable, the Docker +container disables password checks for all database users. - +If you want to access the container from the host but avoid exposing it to the +outside world, you can bind to `127.0.0.1` instead of the public interface, using this command: - Name | Version | Schema | Description - ---------------------+---------+------------+--------------------------------------------------------------------------------------- - plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language - timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) +```bash +docker run -d --name timescaledb -p 127.0.0.1:5432:5432 \ +-e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 +``` - +If you don't want to install `psql` and other $PG client tools locally, +or if you are using a Microsoft Windows host system, you can connect using the +version of `psql` that is bundled within the container with this command: - +```bash +docker exec -it timescaledb psql -U postgres +``` - Press q to exit the list of extensions. +Existing containers can be stopped using `docker stop` and started again with +`docker start` while retaining their volumes and data. When you create a new +container using the `docker run` command, by default you also create a new data +volume. When you remove a Docker container with `docker rm`, the data volume +persists on disk until you explicitly delete it. You can use the `docker volume +ls` command to list existing docker volumes. If you want to store the data from +your Docker container in a host directory, or you want to run the Docker image +on top of an existing data directory, you can specify the directory to mount a +data volume using the `-v` flag: + +```bash +docker run -d --name timescaledb -p 5432:5432 \ +-v /your/data/dir:/home/postgres/pgdata/data \ +-e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 +``` + +When you install $TIMESCALE_DB using a Docker container, the $PG settings +are inherited from the container. In most cases, you do not need to adjust them. +However, if you need to change a setting, you can add `-c setting=value` to your +Docker `run` command. For more information, see the +[Docker documentation][docker-postgres]. + +The link provided in these instructions is for the latest version of $TIMESCALE_DB +on $PG 16. To find other Docker tags you can use, see the [Dockerhub repository][dockerhub]. + +## View logs in Docker + +If you have $TIMESCALE_DB installed in a Docker container, you can view your logs +using Docker, instead of looking in `/var/lib/logs` or `/var/logs`. For more +information, see the [Docker documentation on logs][docker-logs]. + + + + [config]: /self-hosted/:currentVersion:/configuration/ [alpine]: https://alpinelinux.org/ [ubuntu]: https://ubuntu.com +[override-binding]: https://www.techrepublic.com/article/how-to-fix-the-docker-and-ufw-security-flaw/ +[alpine]: https://alpinelinux.org/ +[config]: /self-hosted/:currentVersion:/configuration/ +[docker-postgres]: https://hub.docker.com/_/postgres +[dockerhub]: https://hub.docker.com/r/timescale/timescaledb/tags?page=1&ordering=last_updated +[ubuntu]: https://ubuntu.com +[docker-logs]: https://docs.docker.com/engine/logging/ +[install-from-source]: /self-hosted/:currentVersion:/install/installation-source/ \ No newline at end of file diff --git a/self-hosted/install/installation-docker.md b/self-hosted/install/installation-docker.md index 943c56bab3..1f82a114e9 100644 --- a/self-hosted/install/installation-docker.md +++ b/self-hosted/install/installation-docker.md @@ -37,97 +37,12 @@ $TIMESCALE_DB on a [supported platform](#supported-platforms) using containers s -And that is it! You have TimescaleDB running on a database on a self-hosted instance of PostgreSQL. - -## More Docker options - -If you want to run the image directly from the container, you can use this -command: - -```bash -docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 -``` - -The `-p` flag binds the container port to the host port. This means that -anything that can access the host port can also access your TimescaleDB container, -so it's important that you set a PostgreSQL password using the -`POSTGRES_PASSWORD` environment variable. Without that variable, the Docker -container disables password checks for all database users. - -If you want to access the container from the host but avoid exposing it to the -outside world, you can bind to `127.0.0.1` instead of the public interface, -using this command: - -```bash -docker run -d --name timescaledb -p 127.0.0.1:5432:5432 \ --e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 -``` - -If you don't want to install `psql` and other PostgreSQL client tools locally, -or if you are using a Microsoft Windows host system, you can connect using the -version of `psql` that is bundled within the container with this command: - -```bash -docker exec -it timescaledb psql -U postgres -``` - -Existing containers can be stopped using `docker stop` and started again with -`docker start` while retaining their volumes and data. When you create a new -container using the `docker run` command, by default you also create a new data -volume. When you remove a Docker container with `docker rm` the data volume -persists on disk until you explicitly delete it. You can use the `docker volume -ls` command to list existing docker volumes. If you want to store the data from -your Docker container in a host directory, or you want to run the Docker image -on top of an existing data directory, you can specify the directory to mount a -data volume using the `-v` flag. - - - -The two container types store PostgreSQL data dir in different places, -make sure you select the correct one to mount: - - -|Container|PGDATA location| -|-|-| -`timescaledb-ha`|`/home/postgres/pgdata/data` -`timescaledb`| `/var/lib/postgresql/data` - - - - -```bash -docker run -d --name timescaledb -p 5432:5432 \ --v /your/data/dir:/home/postgres/pgdata/data \ --e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 -``` - -When you install TimescaleDB using a Docker container, the PostgreSQL settings -are inherited from the container. In most cases, you do not need to adjust them. -However, if you need to change a setting you can add `-c setting=value` to your -Docker `run` command. For more information, see the -[Docker documentation][docker-postgres]. - -The link provided in these instructions is for the latest version of TimescaleDB -on PostgreSQL 16. To find other Docker tags you can use, see the -[Dockerhub repository][dockerhub]. - - -### View logs in Docker - -If you have TimescaleDB installed in a Docker container, you can view your logs -using Docker, instead of looking in `/var/lib/logs` or `/var/logs`. For more -information, see the [Docker documentation on logs][docker-logs]. +And that is it! You have $TIMESCALE_DB running on a database on a self-hosted instance of $PG. ## Where to next -[alpine]: https://alpinelinux.org/ -[config]: /self-hosted/:currentVersion:/configuration/ [docker-install]: https://docs.docker.com/get-started/get-docker/ -[docker-postgres]: https://hub.docker.com/_/postgres -[dockerhub]: https://hub.docker.com/r/timescale/timescaledb/tags?page=1&ordering=last_updated [install-psql]: https://www.timescale.com/blog/how-to-install-psql-on-mac-ubuntu-debian-windows/ -[ubuntu]: https://ubuntu.com -[docker-logs]: https://docs.docker.com/engine/logging/ -[install-from-source]: /self-hosted/:currentVersion:/install/installation-source/ + diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index d8feb22fe9..3228cca9ba 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -80,48 +80,35 @@ To upgrade $TIMESCALE_DB 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 $TIMESCALE_DB image. - - This command pulls the latest version of $TIMESCALE_DB running on $PG 17. - - - - + - docker pull timescale/timescaledb-ha:pg17 + - - - + - docker pull timescale/timescaledb:latest-pg17 +1. **Pull the latest $TIMESCALE_DB image** - + This command pulls the latest version of $TIMESCALE_DB running on $PG 17: - + ``` + docker pull timescale/timescaledb-ha:pg17 + ``` - If you're using another version of $PG, look for the relevant tag in the - [$TIMESCALE_DB HA](https://hub.docker.com/r/timescale/timescaledb-ha/tags) or - [TimescaleDB light](https://hub.docker.com/r/timescale/timescaledb) repositories on Docker Hub. + If you're using another version of $PG, look for the relevant tag in the [$TIMESCALE_DB HA](https://hub.docker.com/r/timescale/timescaledb-ha/tags) repository on Docker Hub. -1. Stop the old container, and remove it: +1. **Stop the old container, and remove it** ```bash docker stop timescaledb docker rm timescaledb ``` -1. Launch a new container with the upgraded Docker image: +1. **Launch a new container with the upgraded Docker image** - The containers store the $PG `` in the following locations: - - - timescaledb-ha:`/home/postgres/pgdata/data` - - timescaledb: `/var/lib/postgresql/data` + The container stores the $PG `` at `/home/postgres/pgdata/data` Update the following command, based on your mount point type to point to the correct data folder: - + @@ -142,41 +129,105 @@ data. - - If you are running $TIMESCALE_DB light, update the command to run `timescale/timescaledb`. -1. Connect to the upgraded instance using `psql` with the `-X` flag: +1. **Connect to the upgraded instance using `psql` with the `-X` flag** ```bash docker exec -it timescaledb psql -U postgres -X ``` -1. At the psql prompt, use the `ALTER` command to upgrade the extension: +1. **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 [$TOOLKIT_LONG][toolkit] extension is packaged with $TIMESCALE_DB HA, it includes additional +hyperfunctions to help you with queries and data analysis. + + + +If you have multiple databases, update each database separately. + + + + + + + + + + + +1. **Pull the latest $TIMESCALE_DB image** + + This command pulls the latest version of $TIMESCALE_DB running on $PG 17. + + ``` + docker pull timescale/timescaledb:latest-pg17 + ``` - + If you're using another version of $PG, look for the relevant tag in the [TimescaleDB light](https://hub.docker.com/r/timescale/timescaledb) repository on Docker Hub. - +1. **Stop the old container, and remove it** + + ```bash + docker stop timescaledb + docker rm timescaledb + ``` + +1. **Launch a new container with the upgraded Docker image** + + The container stores the $PG `` in `/var/lib/postgresql/data`. Update the following command, based on your mount point type, to point to the correct data folder: + + + + + + ```bash + docker run -v <>: \ + -d --name timescaledb -p 5432:5432 timescaledb:latest-pg17 + ``` - ALTER EXTENSION timescaledb UPDATE; - CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit; - ALTER EXTENSION timescaledb_toolkit UPDATE; - + + + ```bash + docker run -v /bind/path/recovered/earlier: -d --name timescaledb \ + -p 5432:5432 timescaledb:latest-pg17 + ``` - ALTER EXTENSION timescaledb UPDATE; - + + +1. **Connect to the upgraded instance using `psql` with the `-X` flag** + + ```bash + docker exec -it timescaledb psql -U postgres -X + ``` + +1. **At the psql prompt, use the `ALTER` command to upgrade the extension** - The [$TOOLKIT_LONG][toolkit] extension is packaged with $TIMESCALE_DB HA, it includes additional - hyperfunctions to help you with queries and data analysis: + ```sql + ALTER EXTENSION timescaledb UPDATE; + ``` + If you have multiple databases, you need to update each database separately. + + + + + + [toolkit]: /self-hosted/:currentVersion:/tooling/install-toolkit/ [relnotes]: https://github.com/timescale/timescaledb/releases From 9bce8eadb36a0c96301b6e9407bfe389d075d8e6 Mon Sep 17 00:00:00 2001 From: atovpeko Date: Wed, 2 Jul 2025 10:34:12 +0300 Subject: [PATCH 03/12] review --- _partials/_install-self-hosted-docker-based.mdx | 6 +++--- self-hosted/install/installation-docker.md | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_partials/_install-self-hosted-docker-based.mdx b/_partials/_install-self-hosted-docker-based.mdx index 9ae236c7f3..fbc139e022 100644 --- a/_partials/_install-self-hosted-docker-based.mdx +++ b/_partials/_install-self-hosted-docker-based.mdx @@ -10,7 +10,7 @@ $TIMESCALE_DB experience. It uses [Ubuntu][ubuntu], includes [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit), and support for PostGIS and Patroni. - To install the latest release based on PostgreSQL 17: + To install the latest release based on $PG 17: ``` docker pull timescale/timescaledb-ha:pg17 @@ -31,7 +31,7 @@ 1. **Connect to a database on your $PG instance** - The default user and database are both `postgres`. You set the password in `POSTGRES_PASSWORD` in the previous step. The default command to connect to $PG in this image is: + The default user and database are both `postgres`. You set the password in `POSTGRES_PASSWORD` in the previous step. The default command to connect to $PG is: ```bash psql -d "postgres://postgres:password@localhost/postgres" @@ -128,7 +128,7 @@ information, see the [Docker documentation on logs][docker-logs]. 1. **Run the $TIMESCALE_DB Docker image** - The light-weight [TimescaleDB](https://hub.docker.com/r/timescale/timescaledb) Docker image uses [Alpine][alpine] and does not contain [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit) or support for PostGIS and Patroni. + The light-weight [$TIMESCALE_DB](https://hub.docker.com/r/timescale/timescaledb) Docker image uses [Alpine][alpine] and does not contain [$TOOLKIT_LONG](https://github.com/timescale/timescaledb-toolkit) or support for PostGIS and Patroni. To install the latest release based on $PG 17: diff --git a/self-hosted/install/installation-docker.md b/self-hosted/install/installation-docker.md index 1f82a114e9..6e2143e032 100644 --- a/self-hosted/install/installation-docker.md +++ b/self-hosted/install/installation-docker.md @@ -12,8 +12,8 @@ import AddTimescaleDBToDB from "versionContent/_partials/_add-timescaledb-to-a-d # Install $TIMESCALE_DB from a Docker container -TimescaleDB is a [PostgreSQL extension](https://www.postgresql.org/docs/current/external-extensions.html) for -time series and demanding workloads that ingest and query high volumes of data. You can install a TimescaleDB +$TIMESCALE_DB is a [$PG extension](https://www.postgresql.org/docs/current/external-extensions.html) for +time series and demanding workloads that ingest and query high volumes of data. You can install a $TIMESCALE_DB instance on any local system from a pre-built Docker container. This section shows you how to @@ -23,7 +23,7 @@ This section shows you how to ### Prerequisites -To run, and connect to a PostgreSQL installation on Docker, you need to install: +To run, and connect to a $PG installation on Docker, you need to install: - [Docker][docker-install] - [psql][install-psql] @@ -31,7 +31,7 @@ To run, and connect to a PostgreSQL installation on Docker, you need to install: ## Install and configure $TIMESCALE_DB on $PG -This section shows you how to install the latest version of PostgreSQL and +This section shows you how to install the latest version of $PG and $TIMESCALE_DB on a [supported platform](#supported-platforms) using containers supplied by $COMPANY. From 6e3772f138051055099d7dcd834b361831b17f62 Mon Sep 17 00:00:00 2001 From: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:33:46 +0300 Subject: [PATCH 04/12] Update self-hosted/upgrades/upgrade-docker.md Co-authored-by: Iain Cox Signed-off-by: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> --- self-hosted/upgrades/upgrade-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index 3228cca9ba..bb007bf6b8 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -123,7 +123,7 @@ data. ```bash docker run -v /bind/path/recovered/earlier: -d --name timescaledb \ - -p 5432:5432 timescale/timescaledb-ha + -p 5432:5432 timescale/timescaledb-ha:pg17 ``` From a46c350e5aeac2b323d7ef4e7238cdc11c842ff9 Mon Sep 17 00:00:00 2001 From: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:33:54 +0300 Subject: [PATCH 05/12] Update self-hosted/upgrades/upgrade-docker.md Co-authored-by: Iain Cox Signed-off-by: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> --- self-hosted/upgrades/upgrade-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index bb007bf6b8..94eacbd0a2 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -122,7 +122,7 @@ data. ```bash - docker run -v /bind/path/recovered/earlier: -d --name timescaledb \ + docker run -v :/home/postgres/pgdata/data -d --name timescaledb \ -p 5432:5432 timescale/timescaledb-ha:pg17 ``` From 8242bf0f385cd473ec08a974842169c7fd43e50e Mon Sep 17 00:00:00 2001 From: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:34:01 +0300 Subject: [PATCH 06/12] Update self-hosted/upgrades/upgrade-docker.md Co-authored-by: Iain Cox Signed-off-by: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> --- self-hosted/upgrades/upgrade-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index 94eacbd0a2..39e20ffeac 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -197,7 +197,7 @@ If you have multiple databases, update each database separately. ```bash docker run -v /bind/path/recovered/earlier: -d --name timescaledb \ - -p 5432:5432 timescaledb:latest-pg17 + -p 5432:5432 timescale/timescaledb:latest-pg17 ``` From 15cd39ebfd360fce1a986a695ff698a29e09b254 Mon Sep 17 00:00:00 2001 From: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:34:14 +0300 Subject: [PATCH 07/12] Update self-hosted/upgrades/upgrade-docker.md Co-authored-by: Iain Cox Signed-off-by: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> --- self-hosted/upgrades/upgrade-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index 39e20ffeac..c4da40228c 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -187,7 +187,7 @@ If you have multiple databases, update each database separately. ```bash - docker run -v <>: \ + docker run -v :/var/lib/postgresql/data \ -d --name timescaledb -p 5432:5432 timescaledb:latest-pg17 ``` From fcf105f27989de658679570edf385f5347ed30b9 Mon Sep 17 00:00:00 2001 From: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:34:19 +0300 Subject: [PATCH 08/12] Update self-hosted/upgrades/upgrade-docker.md Co-authored-by: Iain Cox Signed-off-by: Anastasiia Tovpeko <114177030+atovpeko@users.noreply.github.com> --- self-hosted/upgrades/upgrade-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index c4da40228c..4b2f186cbd 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -188,7 +188,7 @@ If you have multiple databases, update each database separately. ```bash docker run -v :/var/lib/postgresql/data \ - -d --name timescaledb -p 5432:5432 timescaledb:latest-pg17 + -d --name timescaledb -p 5432:5432 timescale/timescaledb:latest-pg17 ``` From da9539b1d1bcba9830193d774ff65fcc74d8b9bd Mon Sep 17 00:00:00 2001 From: atovpeko Date: Thu, 3 Jul 2025 13:47:07 +0300 Subject: [PATCH 09/12] updates on review --- self-hosted/upgrades/upgrade-docker.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index 4b2f186cbd..a8973f03d9 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -42,7 +42,7 @@ mounts, or bind mounts. ``` This returns either `volume` or `bind`. -1. Note the volume or bind used by your container. +1. Note the volume or bind used by your container: @@ -50,8 +50,10 @@ mounts, or bind mounts. ```bash docker inspect timescaledb --format='{{range .Mounts }}{{.Name}}{{end}}' - - You see something like this: + ``` + Docker returns the ``. You see something like this: + + ``` 069ba64815f0c26783b81a5f0ca813227fde8491f429cf77ed9a5ae3536c0b2c ``` @@ -61,8 +63,11 @@ mounts, or bind mounts. ```bash docker inspect timescaledb --format='{{range .Mounts }}{{.Source}}{{end}}' - - You see something like this: + ``` + + Docker returns the ``. You see something like this: + + ``` /path/to/data ``` @@ -105,16 +110,15 @@ data. 1. **Launch a new container with the upgraded Docker image** - The container stores the $PG `` at `/home/postgres/pgdata/data` + Launch based on your mount point type: - Update the following command, based on your mount point type to point to the correct data folder: ```bash - docker run -v <>: \ - -d --name timescaledb -p 5432:5432 timescale/timescaledb-ha + docker run -v :/home/postgres/pgdata/data + -d --name timescaledb -p 5432:5432 timescale/timescaledb-ha:pg17 ``` @@ -180,7 +184,7 @@ If you have multiple databases, update each database separately. 1. **Launch a new container with the upgraded Docker image** - The container stores the $PG `` in `/var/lib/postgresql/data`. Update the following command, based on your mount point type, to point to the correct data folder: + Launch based on your mount point type: From 8b9be28904196e673793897dac286f1eb9990dba Mon Sep 17 00:00:00 2001 From: Iain Date: Fri, 4 Jul 2025 16:33:20 +0200 Subject: [PATCH 10/12] chore: change to force build update. --- self-hosted/upgrades/upgrade-docker.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index a8973f03d9..8ef1838025 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -1,5 +1,5 @@ --- -title: Upgrade within a Docker container +title: Upgrade TimescaleDB running in Docker excerpt: Upgrade self-hosted TimescaleDB running in a Docker container to a new minor version products: [self_hosted] keywords: [upgrades, Docker] @@ -161,6 +161,7 @@ If you have multiple databases, update each database separately. + From 0db48fa23860c067dbc5406cb7341c37982907a9 Mon Sep 17 00:00:00 2001 From: Iain Date: Fri, 4 Jul 2025 17:31:54 +0200 Subject: [PATCH 11/12] chore: force volume in the HA image. --- _partials/_install-self-hosted-docker-based.mdx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_partials/_install-self-hosted-docker-based.mdx b/_partials/_install-self-hosted-docker-based.mdx index fbc139e022..352c5f4cc3 100644 --- a/_partials/_install-self-hosted-docker-based.mdx +++ b/_partials/_install-self-hosted-docker-based.mdx @@ -20,10 +20,11 @@ 1. **Run the container** + Replace `` with the path to the folder you want to keep your data in the following command. ``` - docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 + docker run -d --name timescaledb -p 5432:5432 -v :/pgdata -e PGDATA=/pgdata -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 ``` - + If you are running multiple container instances, change the port each Docker instance runs on. On UNIX-based systems, Docker modifies Linux IP tables to bind the container. If your system uses Linux Uncomplicated Firewall (UFW), Docker may @@ -50,7 +51,7 @@ ---------------------+---------+------------+--------------------------------------------------------------------------------------- plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language timescaledb | 2.20.3 | public | Enables scalable inserts and complex queries for time-series data (Community Edition) - timescaledb_toolkit | 1.19.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities + timescaledb_toolkit | 1.21.0 | public | Library of analytical hyperfunctions, time-series pipelining, and other SQL utilities (3 rows) ``` @@ -252,4 +253,4 @@ information, see the [Docker documentation on logs][docker-logs]. [dockerhub]: https://hub.docker.com/r/timescale/timescaledb/tags?page=1&ordering=last_updated [ubuntu]: https://ubuntu.com [docker-logs]: https://docs.docker.com/engine/logging/ -[install-from-source]: /self-hosted/:currentVersion:/install/installation-source/ \ No newline at end of file +[install-from-source]: /self-hosted/:currentVersion:/install/installation-source/ From b60adc266cc5f5c50baa85eae80ff453102f5100 Mon Sep 17 00:00:00 2001 From: Iain Date: Fri, 4 Jul 2025 17:40:55 +0200 Subject: [PATCH 12/12] chore: and clean up. --- .../_install-self-hosted-docker-based.mdx | 46 +------------------ self-hosted/upgrades/upgrade-docker.md | 2 +- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/_partials/_install-self-hosted-docker-based.mdx b/_partials/_install-self-hosted-docker-based.mdx index 352c5f4cc3..83103bbae7 100644 --- a/_partials/_install-self-hosted-docker-based.mdx +++ b/_partials/_install-self-hosted-docker-based.mdx @@ -61,25 +61,12 @@ ## More Docker options -If you want to run the image directly from the container, you can use this -command: - -```bash -docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 -``` - -The `-p` flag binds the container port to the host port. This means that -anything that can access the host port can also access your $TIMESCALE_DB container, -so it's important that you set a $PG password using the -`POSTGRES_PASSWORD` environment variable. Without that variable, the Docker -container disables password checks for all database users. - If you want to access the container from the host but avoid exposing it to the outside world, you can bind to `127.0.0.1` instead of the public interface, using this command: ```bash docker run -d --name timescaledb -p 127.0.0.1:5432:5432 \ --e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 +-v :/pgdata -e PGDATA=/pgdata -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 ``` If you don't want to install `psql` and other $PG client tools locally, @@ -90,22 +77,6 @@ version of `psql` that is bundled within the container with this command: docker exec -it timescaledb psql -U postgres ``` -Existing containers can be stopped using `docker stop` and started again with -`docker start` while retaining their volumes and data. When you create a new -container using the `docker run` command, by default you also create a new data -volume. When you remove a Docker container with `docker rm`, the data volume -persists on disk until you explicitly delete it. You can use the `docker volume -ls` command to list existing docker volumes. If you want to store the data from -your Docker container in a host directory, or you want to run the Docker image -on top of an existing data directory, you can specify the directory to mount a -data volume using the `-v` flag: - -```bash -docker run -d --name timescaledb -p 5432:5432 \ --v /your/data/dir:/home/postgres/pgdata/data \ --e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg17 -``` - When you install $TIMESCALE_DB using a Docker container, the $PG settings are inherited from the container. In most cases, you do not need to adjust them. However, if you need to change a setting, you can add `-c setting=value` to your @@ -113,7 +84,7 @@ Docker `run` command. For more information, see the [Docker documentation][docker-postgres]. The link provided in these instructions is for the latest version of $TIMESCALE_DB -on $PG 16. To find other Docker tags you can use, see the [Dockerhub repository][dockerhub]. +on $PG 17. To find other Docker tags you can use, see the [Dockerhub repository][dockerhub]. ## View logs in Docker @@ -177,19 +148,6 @@ information, see the [Docker documentation on logs][docker-logs]. ## More Docker options -If you want to run the image directly from the container, you can use this -command: - -```bash -docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb:latest-pg17 -``` - -The `-p` flag binds the container port to the host port. This means that -anything that can access the host port can also access your $TIMESCALE_DB container, -so it's important that you set a $PG password using the -`POSTGRES_PASSWORD` environment variable. Without that variable, the Docker -container disables password checks for all database users. - If you want to access the container from the host but avoid exposing it to the outside world, you can bind to `127.0.0.1` instead of the public interface, using this command: diff --git a/self-hosted/upgrades/upgrade-docker.md b/self-hosted/upgrades/upgrade-docker.md index 8ef1838025..65aa6af09c 100644 --- a/self-hosted/upgrades/upgrade-docker.md +++ b/self-hosted/upgrades/upgrade-docker.md @@ -201,7 +201,7 @@ If you have multiple databases, update each database separately. ```bash - docker run -v /bind/path/recovered/earlier: -d --name timescaledb \ + docker run -v : -d --name timescaledb \ -p 5432:5432 timescale/timescaledb:latest-pg17 ```