# docker-library/mongo architecture

> Architecture diagram of the GitHub repository docker-library/mongo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/docker-library/mongo
- Repository: https://github.com/docker-library/mongo

## Overview

##### Project type and purpose
- This is an “Official Image” Git repository for MongoDB Docker images. It contains everything needed to build, test, and publish MongoDB containers for multiple versions (6.0, 7.0, 8.0) on both Linux and various Windows bases.
- Its purpose is to:
- Maintain versioned Dockerfiles (and Windows variants)
- Use templates + scripts to generate final Dockerfiles and Docker-Hub metadata
- Run CI to lint, validate and test those images
- Push built images to Docker Hub as the “source of truth” for the mongo official image

##### File structure
- Top-level:
- Dockerfile-linux.template / Dockerfile-windows.template – generic templates
- apply-templates.sh – applies templates for all versions
- generate-stackbrew-library.sh – produces the library file used by official-images
- versions.json / versions.sh – declare supported MongoDB versions and variants
- pgp-keys.json / pgp-keys.sh – manage MongoDB signing keys
- .github/workflows/ci.yml & verify-templating.yml – define GitHub Actions jobs
- Version directories (6.0, 6.0-rc, 7.0, 7.0-rc, 8.0, 8.0-rc):
- Each has its own Dockerfile (overrides from template) and docker-entrypoint.sh
- A nested windows/ folder with nanoserver and windowsservercore Dockerfiles
- CI config:
- ci.yml runs lint, build, and test matrix for linux + Windows
- verify-templating.yml ensures templates are correctly applied

##### README for additional insights
- Confirms this is an Official Image repo
- Points to external “official-images” and “docs” repos for published metadata and long form docs

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Templates & Definitions
    subgraph "Templates & Definitions"
        direction TB
        DL_t["Dockerfile-linux.template"]:::templates
        DW_t["Dockerfile-windows.template"]:::templates
        VJ["versions.json"]:::templates
        VS["versions.sh"]:::templates
    end

    %% Templating Engine & Scripts
    subgraph "Templating & Scripts"
        direction TB
        AT["apply-templates.sh"]:::scripts
        PKJ["pgp-keys.json"]:::scripts
        PKS["pgp-keys.sh"]:::scripts
        GS["generate-stackbrew-library.sh"]:::scripts
    end

    %% Versioned Builds
    subgraph "Versioned Builds"
        direction TB
        subgraph "6.0"
            direction TB
            V60df["6.0/Dockerfile"]:::artifact
            V60ep["6.0/docker-entrypoint.sh"]:::artifact
            subgraph "windows variants"
                direction TB
                V60win["6.0/windows/.../Dockerfile"]:::artifact
            end
        end
        subgraph "6.0-rc"
            direction TB
            V60rcdf["6.0-rc/Dockerfile"]:::artifact
            V60rcep["6.0-rc/docker-entrypoint.sh"]:::artifact
            subgraph "windows variants"
                direction TB
                V60rcwin["6.0-rc/windows/.../Dockerfile"]:::artifact
            end
        end
        subgraph "7.0"
            direction TB
            V70df["7.0/Dockerfile"]:::artifact
            V70ep["7.0/docker-entrypoint.sh"]:::artifact
            subgraph "windows variants"
                direction TB
                V70win["7.0/windows/.../Dockerfile"]:::artifact
            end
        end
        subgraph "7.0-rc"
            direction TB
            V70rcdf["7.0-rc/Dockerfile"]:::artifact
            V70rcep["7.0-rc/docker-entrypoint.sh"]:::artifact
            subgraph "windows variants"
                direction TB
                V70rcwin["7.0-rc/windows/.../Dockerfile"]:::artifact
            end
        end
        subgraph "8.0"
            direction TB
            V80df["8.0/Dockerfile"]:::artifact
            V80ep["8.0/docker-entrypoint.sh"]:::artifact
            subgraph "windows variants"
                direction TB
                V80win["8.0/windows/.../Dockerfile"]:::artifact
            end
        end
        subgraph "8.0-rc"
            direction TB
            V80rcdf["8.0-rc/Dockerfile"]:::artifact
            V80rcep["8.0-rc/docker-entrypoint.sh"]:::artifact
            subgraph "windows variants"
                direction TB
                V80rcwin["8.0-rc/windows/.../Dockerfile"]:::artifact
            end
        end
    end

    %% CI/CD Pipelines
    subgraph "CI/CD Pipelines"
        direction TB
        CI[".github/workflows/ci.yml"]:::ci
        VT[".github/workflows/verify-templating.yml"]:::ci
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GH["GitHub"]:::external
        DH["Docker Hub"]:::external
        OF["official-images repo"]:::external
    end

    %% Connections
    DL_t -->|feeds| AT
    DW_t -->|feeds| AT
    VJ -->|feeds| AT
    VS -->|feeds| AT

    AT -->|generates| V60df
    AT --> V60ep
    AT -.-> V60win
    AT --> V60rcdf
    AT --> V60rcep
    AT -.-> V60rcwin
    AT --> V70df
    AT --> V70ep
    AT -.-> V70win
    AT --> V70rcdf
    AT --> V70rcep
    AT -.-> V70rcwin
    AT --> V80df
    AT --> V80ep
    AT -.-> V80win
    AT --> V80rcdf
    AT --> V80rcep
    AT -.-> V80rcwin

    VJ -->|provides versions| GS
    VS --> GS
    GS -->|outputs manifest| OF

    V60df -->|builds| CI
    V60ep --> CI
    V60win --> CI
    V60rcdf --> CI
    V60rcep --> CI
    V60rcwin --> CI
    V70df --> CI
    V70ep --> CI
    V70win --> CI
    V70rcdf --> CI
    V70rcep --> CI
    V70rcwin --> CI
    V80df --> CI
    V80ep --> CI
    V80win --> CI
    V80rcdf --> CI
    V80rcep --> CI
    V80rcwin --> CI

    AT -->|on change| VT
    VJ --> VT
    VS --> VT
    DL_t --> VT
    DW_t --> VT

    CI -->|pushes images| DH

    GH -->|triggers| CI
    GH --> VT

    %% Click Events
    click DL_t "https://github.com/docker-library/mongo/blob/master/Dockerfile-linux.template"
    click DW_t "https://github.com/docker-library/mongo/blob/master/Dockerfile-windows.template"
    click VJ "https://github.com/docker-library/mongo/blob/master/versions.json"
    click VS "https://github.com/docker-library/mongo/blob/master/versions.sh"
    click AT "https://github.com/docker-library/mongo/blob/master/apply-templates.sh"
    click PKJ "https://github.com/docker-library/mongo/blob/master/pgp-keys.json"
    click PKS "https://github.com/docker-library/mongo/blob/master/pgp-keys.sh"
    click GS "https://github.com/docker-library/mongo/blob/master/generate-stackbrew-library.sh"
    click V60df "https://github.com/docker-library/mongo/tree/master/6.0/Dockerfile"
    click V60ep "https://github.com/docker-library/mongo/blob/master/6.0/docker-entrypoint.sh"
    click V60win "https://github.com/docker-library/mongo/tree/master/6.0/windows/.../Dockerfile"
    click V60rcdf "https://github.com/docker-library/mongo/tree/master/6.0-rc/Dockerfile"
    click V60rcep "https://github.com/docker-library/mongo/blob/master/6.0-rc/docker-entrypoint.sh"
    click V60rcwin "https://github.com/docker-library/mongo/tree/master/6.0-rc/windows/.../Dockerfile"
    click V70df "https://github.com/docker-library/mongo/tree/master/7.0/Dockerfile"
    click V70ep "https://github.com/docker-library/mongo/blob/master/7.0/docker-entrypoint.sh"
    click V70win "https://github.com/docker-library/mongo/tree/master/7.0/windows/.../Dockerfile"
    click V70rcdf "https://github.com/docker-library/mongo/tree/master/7.0-rc/Dockerfile"
    click V70rcep "https://github.com/docker-library/mongo/blob/master/7.0-rc/docker-entrypoint.sh"
    click V70rcwin "https://github.com/docker-library/mongo/tree/master/7.0-rc/windows/.../Dockerfile"
    click V80df "https://github.com/docker-library/mongo/tree/master/8.0/Dockerfile"
    click V80ep "https://github.com/docker-library/mongo/blob/master/8.0/docker-entrypoint.sh"
    click V80win "https://github.com/docker-library/mongo/tree/master/8.0/windows/.../Dockerfile"
    click V80rcdf "https://github.com/docker-library/mongo/tree/master/8.0-rc/Dockerfile"
    click V80rcep "https://github.com/docker-library/mongo/blob/master/8.0-rc/docker-entrypoint.sh"
    click V80rcwin "https://github.com/docker-library/mongo/tree/master/8.0-rc/windows/.../Dockerfile"
    click CI "https://github.com/docker-library/mongo/blob/master/.github/workflows/ci.yml"
    click VT "https://github.com/docker-library/mongo/blob/master/.github/workflows/verify-templating.yml"

    %% Styles
    classDef templates fill:#D0E8FF,stroke:#339,stroke-width:1px
    classDef scripts fill:#CFE8FF,stroke:#336,stroke-width:1px
    classDef artifact fill:#E0FFE0,stroke:#393,stroke-width:1px
    classDef ci fill:#FFE8C0,stroke:#996600,stroke-width:1px
    classDef external fill:#F0F0F0,stroke-dasharray: 5 5,stroke:#666,stroke-width:1px
```
