You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1017 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

拉取镜像

docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/postgres:latest
docker tag  swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/postgres:latest  docker.io/postgres:latest

# 创建数据卷
docker volume create postgres-volume

# 创建容器
mkdir /var/lib/postgresql/data -p
docker run -d --name=postgres17 -p 5432:5432 -v postgres-volume:/var/lib/postgresql/data -e POSTGRES_PASSWORD=DsideaL147258369 -e POSTGRES_USER=postgres docker.io/postgres:latest

# -d 将以分离模式运行此容器,以便它在后台运行。
# --name 将名称“postgres13”分配给您的容器实例名字,通过这个名字以后可以直接启动
# -p会将 PostgreSQL 容器端口 5432 绑定到主机上的相同端口外部通过5432这个命令可以直接访问
# -v选项将容器内的目录/var/lib/postgresql绑定到postgres-volume上保证你以后的数据不会丢失
# -e设置环境变量。在这种情况下PostgreSQL表示容器的密码