-
First, pull the docker image of postgres15
PS> docker pull postgres:15-alpine
-
Then use the makefile
- To Initialize the image for local
PS> make postgresinit
- To open the console (psql)
PS> make postgres
- To Create the db for users
PS> make createdbusers
- To drop the users db
PS> make dropdbusers
- To open the console (bash)
PS> make bash
- To Initialize the image for local
-
For using the psql
- To see all the databases
root=# \l
- connect to the db wanted
root=# \c <yourdb>
- to see all the relations or tables
root=# \dt
- to see all values in the table
root=# SELECT * FROM <tablename>;
- to quit
root=# \q
- To see all the databases
- If it says SSL Enabled error
- Then Use bash:
PS> make bash
- go to postgres.conf file
f92622037df6:/# cd /var/lib/postgresql/data
- check the SSL setting
If it is not this in the first line.
f92622037df6:/# cat postgresql.conf | grep ssl
- Uncomment the line:
# ssl = off
use only vi, as it is the only one that is supported.f92622037df6:/# vi postgresql.conf
- Then demote yourself as a normal user and restart the postgres service:
f92622037df6:/# su - postgres f92622037df6:~$ pg_ctl restart
- If the image has stopped running, then run the image from Docker Desktop.
- Then try to use the service again. It should work.
- Then Use bash: