Skip to content

Instantly share code, notes, and snippets.

@JakobMiksch
Last active July 7, 2024 08:36
Show Gist options
  • Select an option

  • Save JakobMiksch/696379464ba29dc459a8fdbe001ba15a to your computer and use it in GitHub Desktop.

Select an option

Save JakobMiksch/696379464ba29dc459a8fdbe001ba15a to your computer and use it in GitHub Desktop.
PostGIS simple Docker Compose file

Run a basic PostGIS database with docker

docker compose up

or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment