docker compose upor directly.
docker run -d \
-e POSTGRES_DB=my_database \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgis/postgis:15-3.4| version: '3.7' | |
| services: | |
| postgres: | |
| image: postgis/postgis:15-3.4 | |
| environment: | |
| - POSTGRES_DB=demo | |
| - POSTGRES_USER=postgres | |
| - POSTGRES_PASSWORD=postgres | |
| ports: | |
| - 5432:5432 | |
| healthcheck: | |
| test: ["CMD-SHELL", "pg_isready -U postgres"] | |
| interval: 5s | |
| timeout: 5s | |
| retries: 5 | |
| volumes: | |
| # - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d # initial SQL files | |
| - ./postgres-data:/var/lib/postgresql/data # mount data to host |