Skip to content

Instantly share code, notes, and snippets.

@bokwoon95
Last active March 26, 2025 07:27
Show Gist options
  • Save bokwoon95/beb833800d575913022df1b99ab6bdfb to your computer and use it in GitHub Desktop.
Save bokwoon95/beb833800d575913022df1b99ab6bdfb to your computer and use it in GitHub Desktop.
How to run Docker SchemaSpy on a locally running Postgres
docker run -v "$PWD/schemaspy_output:/output" schemaspy/schemaspy:latest \
-t pgsql \
-host host.docker.internal \
-port 5432 \
-db my_database \
-u my_username \
-p my_password \
-vizjs
# -host needs to be host.docker.internal to refer to your local machine's localhost,
# not the schemaspy container's localhost. Schemaspy's docker documentation for this is horrible.
# -vizjs is optional depending on whether you want to use the graphviz depedency or the embedded viz.js.
# If you are running schemaspy natively (without docker) I would most certainly recommend using viz.js
# because getting graphviz installed is a $$ PITA. Especially on macOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment