> For the complete documentation index, see [llms.txt](https://notes.joeir.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.joeir.net/application-infrastructure/databases/postgresql.md).

# PostgreSQL

## Reference Links

## Configuration

## Docker

### Image

{% embed url="<https://hub.docker.com/_/postgres>" %}

### Compose

```yaml
version: "3.7"
services:
  postgres: # access with `psql -Uuser -h127.0.0.1 -p5432 database -W`
    # image reference: https://hub.docker.com/_/postgres
    image: library/postgres:15.3-alpine
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_USER: user
      POSTGRES_DB: database
    ports: ["5432:5432"]
    network_mode: host
    volumes: # [] # uncomment this and comment below to remove persistence
      - ./.data/postgres/data/var/lib/postgres/data:/var/lib/postgresql/data
```
