1、下载 Postgres
镜像
下载最新版本的 Postgres 镜像(默认是 latest 版本):
docker pull postgres
如果想要下载其他版本,比如常用的 10 版本的话,在镜像后面指定版本:
docker pull postgres:10.21-alpine
更多版本的镜像可以访问 Docker 官网:https://hub.docker.com/_/postgres?tab=tags
2、创建并运行 PgSQL
容器
启动命令:
docker run -d \
-p 5432:5432