Docker Postgresql installation quickly


[root@02a854a7db8d /]# uname -r
3.10.0–862.14.4.el7.x86_64
[root@02a854a7db8d /]#
Use root login, or provide an account with sudo permissions, it should be possibleUpdate yum first[root@pankajconnect ~]# yum update -y

Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.njupt.edu.cn
* updates: mirrors.aliyun.com
Resolving Dependencies
→ Running transaction check
Where -y stands for automatic reply yes to prevent this
[root@pankajconnect ~]# yum install docker -y
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.njupt.edu.cn
* updates: mirrors.aliyun.com
Resolving Dependencies
— — — -
Next start dockersystemctl status docker.serviceafter finishing[root@pankajconnect Desktop]# docker search postgres--Continue as below....
[root@pankajconnect data]# run, Create and run a container;, 
— namespecify the name of the created container
-e POSTGRES_PASSWORD=password;, set environment variables, specify the database login password as password;, -p 5432:5432port mapping will map the container’s 5432 port to the external machine’s 54321 port;

postgres=# show port;
port
— — —
5432
(1 row)

postgres=# show config_file ;
config_file
— — — — — — — — — — — — — — — — — — — — —
/var/lib/postgresql/data/postgresql.conf
(1 row)
postgres=# \q
Note : 
Postgres mirroring default user name postgres,
login password for the creation of a container is the specified value.
[root@pankajconnect ~]# [root@pankajconnect ~]# psql -h 192.168.40.105 -p 5432 -d postgres -U postgres

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store