Changing configuration with Docker

When running TimescaleDB via a Docker container, there are two approaches to modifying your PostgreSQL configuration. In the following example, we modify the size of the database instance’s write-ahead-log (WAL) from 1GB to 2GB in a Docker container named timescaledb.

Modifying postgres.conf inside Docker

  1. Get into a shell in Docker in order to change the configuration on a running container.
  1. docker start timescaledb
  2. docker exec -i -t timescaledb /bin/bash
  1. Edit and then save the config file, modifying the setting for the desired configuration parameter (e.g., max_wal_size).
  1. vi /var/lib/postgresql/data/postgresql.conf
  1. Restart the container so the config gets reloaded.
  1. docker restart timescaledb
  1. Test to see if the change worked.
  1. docker exec -it timescaledb psql -U postgres
  2. postgres=# show max_wal_size;
  3. max_wal_size
  4. --------------
  5. 2GB

Specify configuration parameters as boot options

Alternatively, one or more parameters can be passed in to the docker run command via a -c option, as in the following.

  1. docker run -i -t timescale/timescaledb:latest-pg10 postgres -cmax_wal_size=2GB

Additional examples of passing in arguments at boot can be found in our discussion about using WAL-E for incremental backup.