Generate database documentation with SchemaSpy & Docker (Windows, Linux, macOS)

Published: (March 25, 2026 at 10:32 PM EDT)
2 min read
Source: Dev.to

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.jar from the Oracle website.

Getting Started

Step 1: Create the working directory

mkdir schemaspy-doc && cd schemaspy-doc
mkdir drivers output

Step 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 -dbHelp

The 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/schemaspy

On Windows (PowerShell)

docker run --rm `
  -v "${PWD}/schemaspy.properties:/schemaspy.properties" `
  -v "${PWD}/output:/output" `
  -v "${PWD}/drivers:/drivers" `
  schemaspy/schemaspy

Note: Using localhost as the database host inside the Docker container will not work because localhost refers to the container itself. Use host.docker.internal to connect to a database running on your host machine, e.g.:

schemaspy.host=host.docker.internal

Step 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

Example Output

Sample 1

Sample 2

0 views
Back to Blog

Related posts

Read more »

Alter Queries

In this assignment, I worked on modifying existing tables using ALTER TABLE. This helped me understand how to update constraints without recreating tables. Task...

Simple MySQL example for E-commice

Hi everyone, I wanted to share my experience with SQL. Below is a simple e‑commerce schema illustrating the main tables and relationships. Role Table sql -- Rol...