Generate database documentation with SchemaSpy & Docker (Windows, Linux, macOS)
Source: Dev.to
Introduction
SchemaSpy is a tool that generates interactive HTML documentation from databases. This guide uses Oracle as an example, but SchemaSpy also works with PostgreSQL, MySQL, SQL Server, etc. With Docker, you can run it on Windows, Linux, or macOS.
Prerequisites
- Docker installed on your system (e.g., Docker Desktop)
- JDBC driver. The Docker image includes drivers for:
- MySQL
- MariaDB
- PostgreSQL
- jTDS
If you use any of these, you do not need to download additional drivers.
- For Oracle, download the JDBC driver
ojdbc11.jarfrom the Oracle website.
Getting Started
Step 1: Create the working directory
mkdir schemaspy-doc && cd schemaspy-doc
mkdir drivers outputStep 2: Add the JDBC driver
Move the downloaded ojdbc11.jar into the drivers/ folder you just created.
Step 3: Create schemaspy.properties
Create a file named schemaspy.properties with the following content:
schemaspy.t=orathin-service
schemaspy.driver=oracle.jdbc.OracleDriver
schemaspy.host=server_or_ip
schemaspy.port=1521
schemaspy.db=db_name
schemaspy.u=database_user
schemaspy.p=database_password
schemaspy.schema=schema_name
schemaspy.norows=true
schemaspy.noviews=true
# Required in Oracle
schemaspy.cat=%If you’re unsure what value to use for the schemaspy.t parameter, run:
docker run --rm schemaspy/schemaspy -dbHelpThe command lists supported database types and the required parameters for each.
Step 4: Run SchemaSpy with Docker
On Linux/macOS
docker run --rm \
-v "$(pwd)/schemaspy.properties:/schemaspy.properties" \
-v "$(pwd)/output:/output" \
-v "$(pwd)/drivers:/drivers" \
schemaspy/schemaspyOn Windows (PowerShell)
docker run --rm `
-v "${PWD}/schemaspy.properties:/schemaspy.properties" `
-v "${PWD}/output:/output" `
-v "${PWD}/drivers:/drivers" `
schemaspy/schemaspyNote: Using
localhostas the database host inside the Docker container will not work becauselocalhostrefers to the container itself. Usehost.docker.internalto connect to a database running on your host machine, e.g.:
schemaspy.host=host.docker.internalStep 5: View the generated documentation
After the command finishes, open output/index.html in a web browser. You’ll see:
- Entity‑relationship diagrams
- Table structures
- Columns, indexes, relationships, etc.
- A beautiful, clickable, interactive HTML interface

