aio

AIO PostgreSQL Image

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.

Image Information

Features

Usage

Basic Usage

# Run PostgreSQL server with default settings
docker run -d --name aio-pg -p 5432:5432 codjix/aio:pg

Custom User, Password, and Database

docker run -d --name aio-pg \
  -p 5432:5432 \
  -e POSTGRES_USER=myuser \
  -e POSTGRES_PASSWORD=mypassword \
  -e POSTGRES_DB=mydb \
  codjix/aio:pg

Data Persistence

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

Environment Variables

Volumes

Ports

Connecting to the Database

From Another Container

docker run -it --rm --link aio-pg:db codjix/aio:pg psql -h db -U postgres

From Host Machine

psql -h localhost -p 5432 -U postgres

Docker Compose Example

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:

Source Code

The Dockerfile and associated scripts for this image are available in the src/pg directory of the AIO repository.