postgreslite
1.1K
A lightweight, optimized PostgreSQL Docker image based on PostgreSQL 17.7, pre-configured for small projects with resource-efficient settings and built-in query performance monitoring.
pg_stat_statements extension pre-enabled for query performance trackingdocker run -d \
--name postgres-lite \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=yourpassword \
-e POSTGRES_DB=mydb \
-p 5432:5432 \
andreidrang/postgreslite
version: '3.8'
services:
db:
image: andreidrang/postgreslite
container_name: postgres-lite
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=yourpassword
- POSTGRES_DB=mydb
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data/pgdata
restart: unless-stopped
volumes:
postgres_data:
This image uses a custom PostgreSQL configuration optimized for small projects. Key settings include:
The image supports all standard PostgreSQL environment variables:
POSTGRES_USER: Database superuser (default: postgres)POSTGRES_PASSWORD: Password for the superuser (required)POSTGRES_DB: Initial database name (default: same as POSTGRES_USER)POSTGRES_INITDB_ARGS: Additional arguments for initdbPGDATA: Data directory (default: /var/lib/postgresql/data/pgdata)The custom configuration file is located at /etc/postgresql.conf inside the container. The image automatically uses this configuration on startup.
To view the current configuration:
docker exec postgres-lite cat /etc/postgresql.conf
The pg_stat_statements extension is pre-enabled. To view query statistics:
-- Connect to your database
psql -U postgres -d mydb
-- Enable the extension (if not already enabled)
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
-- View top queries by total execution time
SELECT
query,
calls,
total_exec_time,
mean_exec_time,
max_exec_time
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 10;
This image is ideal for:
Recommended minimum resources:
This image is based on the official PostgreSQL Docker image, which uses the PostgreSQL License (similar to BSD/MIT).
For issues, questions, or contributions, please visit the GitHub repository.
Content type
Image
Digest
sha256:dfb0c6e72…
Size
172.4 MB
Last updated
3 months ago
docker pull andreidrang/postgreslite:18.4