u
This commit is contained in:
1 parent
200f72eb86
commit
91ae4cb474
19 files changed
+650
-148
No files matched your search
@@ -0,0 +1,32 @@
|
||||
# 安装
|
||||
|
||||
## Docker安装
|
||||
|
||||
### 1. 拉取镜像
|
||||
|
||||
```
|
||||
docker pull postgres
|
||||
```
|
||||
|
||||
### 2. 创建数据卷
|
||||
|
||||
创建一个数据库以持久化PostgreSQL的数据
|
||||
|
||||
```bash
|
||||
docker volume create postgre-data
|
||||
```
|
||||
|
||||
### 3. 创建并运行容器
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--name postgres \
|
||||
-e POSTGRES_PASSWORD=123456 \
|
||||
-v ./data/postgres:/var/lib/postgresql/data/pgdata \
|
||||
-p 5432:5432 \
|
||||
postgres
|
||||
|
||||
```
|
||||
|
||||
上述设定了数据卷,以及暴露了端口`5432`,这是PostgreSQL的默认端口。
|
||||
|
||||
Reference in new issue
Block a user