-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathpostgres
77 lines (44 loc) · 2.2 KB
/
postgres
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# https://nickjanetakis.com/blog/docker-tip-79-saving-a-postgres-database-in-a-docker-image
# https://www.postgresqltutorial.com/postgresql-show-databases/#:~:text=Use%20%5Cl%20or%20%5Cl%2B%20in,pg_database%20to%20get%20all%20databases.
# https://onexlab-io.medium.com/golang-postgres-8b26d2c777e
docker network create postgres
#Postgres Setup
docker run --name postgres --network="postgres" -e POSTGRES_PASSWORD="12345678" -e POSTGRES_USER=asim -e POSTGRES_DB=mydb -e PGDATA=/var/lib/postgresql/data/pgdata -v /root/mount:/var/lib/postgresql/data -id postgres:latest
# Adminer Setup
docker run --link postgres:db --network="postgres" -p 8080:8080 -id adminer
### PGADMIN
docker run --name pgadmin -e PGADMIN_DEFAULT_EMAIL="[email protected]" -e PGADMIN_DEFAULT_PASSWORD="asimarain" --network="postgres" -p 8090:80 -id dpage/pgadmin4:latest
# Create a Connection
# connection-name anynameyouwant
#username asim
#password 12345678
#dbname postgres
#END
#!/bin/bash
# https://nickjanetakis.com/blog/docker-tip-79-saving-a-postgres-database-in-a-docker-image
# https://www.postgresqltutorial.com/postgresql-show-databases/#:~:text=Use%20%5Cl%20or%20%5Cl%2B%20in,pg_database%20to%20get%20all%20databases.
docker network create postgres
#Postgres Setup
docker run --name postgres --network="postgres" -e POSTGRES_PASSWORD="12345678" -id quickbooks2018/postgres
# Adminer Setup
docker run --link postgres:db --network="postgres" -p 8080:8080 -id adminer
# Dockerfile
FROM postgres:11.5-alpine
COPY 001_data.sql /docker-entrypoint-initdb.d/001_data.sql
ENV PGDATA=/data
# user ---> postgres
# password ---> 12345678
# Leave blank DBName or postgres
# docker pull quickbooks2018/postgres
####################################################################################################################
#!/bin/bash
#Postgres Setup
docker run --name postgres --network="postgres" -e POSTGRES_PASSWORD="12345678" -p 5432:5432 -id quickbooks2018/postgres
# Adminer Setup
docker run --link postgres:db --network="postgres" -p 8080:8080 -id adminer
#END
# Restore a Postgres
--------------------
# https://www.postgresqltutorial.com/postgresql-restore-database/
pg_restore -U asim --dbname my_dev < mydb.sql