> For the complete documentation index, see [llms.txt](https://dev-notes.vinguyen.blog/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev-notes.vinguyen.blog/notes/docker-compose-samples/docker-compose-postgresql.md).

# docker-compose -  PostgreSQL

```
version: '3.8'
services:
  db:
    image: postgres:14.1-alpine
    restart: always
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - '5432:5432'
    volumes: 
      - db:/var/lib/postgresql/data
volumes:
  db:
    driver: local
```

* <https://hub.docker.com/_/postgres>
* <https://geshan.com.np/blog/2021/12/docker-postgres/>
