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.
docker start timescaledb
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).
vi /var/lib/postgresql/data/postgresql.conf
  1. Restart the container so the config gets reloaded.
docker restart timescaledb
  1. Test to see if the change worked.
docker exec -it timescaledb psql -U postgres

    postgres=# show max_wal_size;
     max_wal_size
    --------------
    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.

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.