I am using Postgres docker 14.4. I want to pass a server configuration (let's say idle_session_timeout
) to the postgres docker. The doc gives an example using docker run
docker run -d --name test-db -e POSTGRES_PASSWORD=postgres postgres -c idle_session_timeout=900000
How this option can be passed in docker-compose? My docker-compose file now looks like below -
version: '3'
services:
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
ports:
- "6555:80" # pg admin
- "6432:6432" # postgres-db
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
postgres-db:
container_name: test-db
image: postgres:14.4
network_mode: "service:pgadmin"
command: -p 6432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGUSER: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -p 6432"]
interval: 5s
timeout: 5s
retries: 3