Skip to content

Commit b47046e

Browse files
adds docker files and README
1 parent 6140a13 commit b47046e

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM postgres:9.6-alpine
2+
3+
WORKDIR ./code
4+
5+
COPY . .

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Docker and Postgres
2+
3+
4+
## Pull the image
5+
$ docker pull ricardoveronica/postgres-pgadmin:tagname
6+
7+
#### Before starting
8+
Go to, docker-compose.yml and put your own data in services
9+
For db:
10+
* POSTGRES_DB
11+
* POSTGRES_USER
12+
* POSTGRES_PASSWORD
13+
For pgadmin:
14+
* PGADMIN_DEFAULT_EMAIL
15+
* PGADMIN_DEFAULT_PASSWORD
16+
17+
### Run
18+
$ docker-compose up
19+
# For detached mode
20+
$ docker-compose up -d
21+
22+
### Start Postgres
23+
$ docker-compose exec db psql -U your_user your_db
24+
25+
### Go to your browser for start PGAdmin
26+
0.0.0.0:16543
27+
28+
### Create a /code directory if you want to import .sql files from psql
29+
\i code/code/your.sql

docker-compose.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: '3'
2+
3+
services:
4+
db:
5+
build: .
6+
environment:
7+
- POSTGRES_DB=mydb
8+
- POSTGRES_USER=user
9+
- POSTGRES_PASSWORD=SuperSecret
10+
volumes:
11+
- ./pgdata:/var/lib/postgresql/data
12+
ports:
13+
- 5432:5432
14+
networks:
15+
- postgres-network
16+
17+
pgadmin:
18+
image: dpage/pgadmin4
19+
environment:
20+
21+
- PGADMIN_DEFAULT_PASSWORD=SuperSecret
22+
ports:
23+
- 16543:80
24+
depends_on:
25+
- db
26+
networks:
27+
- postgres-network
28+
29+
networks:
30+
postgres-network:
31+
driver: bridge

0 commit comments

Comments
 (0)