Adminer + PostgreSQL Docker Compose Example
Adminer database UI wired to a PostgreSQL instance for local development.
The compose.yaml
name: adminer-pg
services:
adminer:
image: adminer:4
ports:
- 8081:8080
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
pgdata: {}
Start it up
# Validate the configuration (does not start anything):
docker compose -f compose.yaml config
# Pull images and start in the background:
docker compose -f compose.yaml pull
docker compose -f compose.yaml up -d
# Check status and follow logs:
docker compose -f compose.yaml ps
docker compose -f compose.yaml logs -f
# Stop and remove (named volumes are kept):
docker compose -f compose.yaml down
Services
- adminer — adminer:4
- db — postgres:16-alpine
Security notes
- warningNo restart policyAdd `restart: unless-stopped` (or `always`) for long-running services.
- warningNo restart policyAdd `restart: unless-stopped` (or `always`) for long-running services.
- warningNo healthcheckAdd a `healthcheck:` that probes a readiness endpoint or a CLI check for the service.
- warningNo memory limitSet a memory limit sized to the workload (e.g. `mem_limit: 512m`).
- warningNo memory limitSet a memory limit sized to the workload (e.g. `mem_limit: 512m`).
Open the template in the generator to apply one-click hardening.
Related templates
FAQ
How do I run this Adminer + PostgreSQL Docker Compose file?
Save it as compose.yaml, then run `docker compose up -d`. Validate first with `docker compose config` and follow logs with `docker compose logs -f`.
Do I need a version field in the Adminer + PostgreSQL Compose file?
No — modern Docker Compose does not require a top-level version field, and this example does not include one.
How do I customize this Adminer + PostgreSQL template?
Open it in the free Docker Compose Generator to change images, ports, volumes, networks, environment variables, and health checks visually, then download your compose.yaml.
Independent educational example. "Docker" is a trademark of Docker, Inc. Review and adapt before using in production.