# josephredfern/docker-mounter architecture

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

- Interactive diagram: https://gitdiagram.com/josephredfern/docker-mounter
- Repository: https://github.com/josephredfern/docker-mounter

## Overview

##### Project type and purpose
- This is an open-source Python CLI utility called “docker-mounter.”
- Purpose: mount the contents of a Docker image directly on the host via overlay2, without spinning up a full container.

##### File structure
- Top-level:
- `.github/workflows/test.yml` – CI pipeline for running tests
- `pyproject.toml` – packaging & configuration (defines dependencies, entry-point)
- `docker_mounter/mounter.py` – core module implementing the mounting logic
- `tests/` – integration and unit tests
- `README.md`, `LICENSE`, `README.md`, `.gitignore`
- No frontend; everything lives in a single Python package with a CLI entry point.

##### README for insights
- Dependencies: Python, Docker daemon socket, overlay2 driver, root privileges
- Workflow: optional image pull → compute layer IDs → mount overlay2 layers → unmount
- Uses external components: Docker daemon (and indirectly Docker registry if pull is enabled)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        CLI["User CLI (docker-mounter)"]:::internal
    end

    %% Application Layer
    subgraph "Application Layer"
        Module["Python Module: mounter.py"]:::internal
    end

    %% External Systems
    subgraph "External Systems"
        Daemon["Docker Daemon (socket interface)"]:::external
        Registry["Docker Registry (HTTPS API)"]:::external
    end

    %% System Layer
    subgraph "System Layer"
        Kernel["Host Kernel: overlay2 driver"]:::external
        Mount["Mount Point (e.g., /mnt/docker-image)"]:::artifact
    end

    %% CI & Tests
    subgraph "CI & Tests"
        CI["CI: GitHub Actions"]:::internal
        UT["Unit Tests: tests/test_mounter.py"]:::internal
        IT["Integration Tests: tests/test_docker_integration.py"]:::internal
    end

    %% Documentation
    subgraph "Documentation & Config"
        README["README.md"]:::internal
        License["LICENSE"]:::internal
        Gitignore[".gitignore"]:::internal
    end

    %% Connections
    CLI -->|"invoke"| Module
    Module -->|"inspect image"| Daemon
    Module -->|"pull layers (optional)"| Registry
    Module -->|"mount overlay"| Kernel
    Kernel -->|"expose FS"| Mount

    CI -->|"runs"| UT
    CI -->|"runs"| IT
    UT -->|"tests logic in"| Module
    IT -->|"mocks Docker"| Module
    IT -->|"mocks socket on"| Daemon

    %% Click Events
    click CLI "https://github.com/josephredfern/docker-mounter/blob/main/pyproject.toml"
    click Module "https://github.com/josephredfern/docker-mounter/blob/main/docker_mounter/mounter.py"
    click CI "https://github.com/josephredfern/docker-mounter/blob/main/.github/workflows/test.yml"
    click UT "https://github.com/josephredfern/docker-mounter/blob/main/tests/test_mounter.py"
    click IT "https://github.com/josephredfern/docker-mounter/blob/main/tests/test_docker_integration.py"
    click README "https://github.com/josephredfern/docker-mounter/blob/main/README.md"
    click License "https://github.com/josephredfern/docker-mounter/tree/main/LICENSE"
    click Gitignore "https://github.com/josephredfern/docker-mounter/blob/main/.gitignore"

    %% Styles
    classDef internal fill:#add8e6,stroke:#333,stroke-width:1px
    classDef external fill:#90ee90,stroke:#333,stroke-width:1px
    classDef artifact fill:#ffa500,stroke:#333,stroke-width:1px
```
