1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-25 16:28:40 +00:00
dockerfiles/postgres/README.md

38 lines
610 B
Markdown
Raw Permalink Normal View History

2016-12-07 01:35:42 +00:00
postgres
========
![](https://www.postgresql.org/media/img/docs/hdr_logo.png)
## docker-compose.yml
```yaml
postgres:
image: postgres:alpine
ports:
- "5432:5432"
2020-10-22 06:41:34 +00:00
volumes:
- ./data:/var/lib/postgresql/data
2016-12-07 01:35:42 +00:00
environment:
2020-10-22 06:41:34 +00:00
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
2016-12-07 01:35:42 +00:00
- POSTGRES_DB=postgres
2020-10-22 06:41:34 +00:00
restart: unless-stopped
2016-12-07 01:35:42 +00:00
```
## up and running
```bash
$ docker-compose up -d
2020-10-22 06:41:34 +00:00
$ docker-compose exec postgres psql -U postgres postgres
2016-12-07 01:35:42 +00:00
>>> SELECT CURRENT_TIMESTAMP;
now
-------------------------------
2016-12-07 01:44:29.872928+00
(1 row)
2018-02-05 10:06:03 +00:00
>>> \?
>>> \d
2016-12-07 01:35:42 +00:00
>>> \q
```