Skip to content
Beau Barker edited this page Oct 28, 2025 · 1 revision

psql is the command-line tool for interacting with your PostgreSQL database.

🔧 Step 1: Create a config directory

mkdir -p db/postgres/rc

You can persist your preferences using .psqlrc and .inputrc files.

📄 .psqlrc

Create .psqlrc with your preferred settings:

db/postgres/rc/.psqlrc

\pset pager off
\setenv PAGER 'less -S'

See the psql reference for all available options.

📄 .inputrc

Create .inputrc to set readline behavior:

db/postgres/rc/.inputrc

set editing-mode vi

🔗 Step 2: Mount and apply the configs

Add to your compose.override.yaml (this file is for development-only overriding of compose.yaml):

db/compose.override.yaml

services:
  postgres:
    volumes:
      - ./postgres/rc:/rc:ro
    environment:
      PSQLRC: /rc/.psqlrc
      INPUTRC: /rc/.inputrc

🔁 Step 3: Restart the Postgres container

docker compose up -d --force-recreate postgres
Clone this wiki locally