📜  从 docker 中运行的 ip pgsql 访问 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:11.891000             🧑  作者: Mango

代码示例1
run the docker postgres - make sure the port is published, I use alpine because it's lightweight.

docker run --rm -P -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD="1234" --name pg postgres:alpine

using another terminal, access the database from the host using the postgres uri

psql postgresql://postgres:1234@localhost:5432/postgres