The codjix/aio:pg image provides a lightweight PostgreSQL database server built on Alpine Linux. This image is designed for both development and production environments.
# Run PostgreSQL server with default settings
docker run -d --name aio-pg -p 5432:5432 codjix/aio:pg
docker run -d --name aio-pg \
-p 5432:5432 \
-e POSTGRES_USER=myuser \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_DB=mydb \
codjix/aio:pg
docker run -d --name aio-pg \
-p 5432:5432 \
-v pg_data:/var/lib/postgresql/data \
-e POSTGRES_USER=myuser \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_DB=mydb \
codjix/aio:pg
POSTGRES_USER: Username for database access (default: postgres)POSTGRES_PASSWORD: Password for database access (default: postgres)POSTGRES_DB: Name of the default database (default: postgres)PGDATA: Location of the database files (default: /var/lib/postgresql/data)PGHOME: PostgreSQL home directory (default: /var/lib/postgresql)/var/lib/postgresql/data: Database files storage5432: PostgreSQL server portdocker run -it --rm --link aio-pg:db codjix/aio:pg psql -h db -U postgres
psql -h localhost -p 5432 -U postgres
version: '3'
services:
postgres:
image: codjix/aio:pg
container_name: aio-pg
ports:
- "5432:5432"
volumes:
- pg_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=myuser
- POSTGRES_PASSWORD=mypassword
- POSTGRES_DB=mydb
restart: unless-stopped
volumes:
pg_data:
The Dockerfile and associated scripts for this image are available in the src/pg directory of the AIO repository.