sudo docker pull postgres
mkdir -p /data/docker/pgsql
sudo docker run -p 54321:5432 --name pgsql -v /data/docker/pgsql:/var/lib/postgresql -d postgres
sudo docker start pgsql
sudo docker exec -it pgsql bash
psql -U postgres
ALTER USER postgres WITH PASSWORD '新密码';
\q
exit
转载于:https://www.cnblogs.com/kellynic/p/9933507.html