我正在尝试在带有 docker 桌面的本地 Windows 机器上使用 postgres 创建一个简单的演示。
这是我的 yaml docker compose 文件,名为img.yaml:
version: '3.6'
services:
postgres-demo:
image: postgres:11.5-alpine
container_name: postgres-demo
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=Welcome
- POSTGRES_DB=conference_app
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
ports:
- 5432:5432
volumes:
- .:/var/lib/my_data
restart: always
Run Code Online (Sandbox Code Playgroud)
我正在使用以下命令运行它:
docker-compose -f img.yaml up
并获得以下输出:
Starting postgres-demo ... done
Attaching to postgres-demo
postgres-demo | 2020-02-12 17:07:46.487 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres-demo | 2020-02-12 17:07:46.487 …Run Code Online (Sandbox Code Playgroud)