写入 docker-compose.yml
cat > docker-compose.yml <<-'EOF'
# https://github.com/docker-library/docs/blob/master/postgres/README.md
# Port: 5432
version: "3"
services:
postgres:
image: postgres:14
env_file: .env
network_mode: host
restart: unless-stopped
volumes:
- $PWD/postgresql/:/var/lib/postgresql/data/
EOF
写入 .env
cat > .env <<-'EOF'
POSTGRES_PASSWORD=<password>
# <password> is the password for the root user
EOF
启动
docker-compose up --detach
停止
docker-compose down