# notglop/docker-drag architecture

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

- Interactive diagram: https://gitdiagram.com/notglop/docker-drag
- Repository: https://github.com/notglop/docker-drag

## Overview

##### Main Components
- CLI Frontend – Represented by the user invoking the script with parameters (e.g., the “hello-world” image or “mcr.microsoft.com/mssql-tools”).
- Core Python Script (docker_pull.py) – Acts as the main engine; it processes input arguments, makes HTTP requests to the registry, and handles responses.
- External Docker Registry – The remote registry (Docker Hub or another registry) accessed via the HTTPS API v2.
- Output Component – The TAR file generated after pulling the image, which is then used by the Docker client with commands like “docker load”.

##### Relationships and Data Flow
- The user triggers the CLI command, passing the image identifier as an argument.
- The script (docker_pull.py) initiates requests to the Docker Registry API endpoint.
- The script then processes the gathered data, compiles it into a TAR file that can later be loaded by Docker.
- Annotations noting that once the TAR file is created, it is meant to be used externally with standard Docker commands (docker load, docker run).

##### Architectural Patterns and Technologies
- Client-Server Interaction: The script behaves as a lightweight client interacting with an external server via RESTful HTTPS calls.
- Data Conversion: Part of the logic involves converting JSON responses (from the registry API) into a binary TAR file format for Docker usage.

## Diagram (Mermaid)

```mermaid
graph TD
    CLI["CLI Input"]:::cli
    Script["docker_pull.py – Processing & API Communication"]:::script
    Registry["Docker Registry (HTTPS API v2)"]:::registry
    Tar["Generated Docker Image TAR File (for docker load)"]:::output

    CLI -->|"triggers"| Script
    Script -->|"HTTP_API_v2_Request"| Registry
    Registry -->|"HTTP_JSON_Response"| Script
    Script -->|"Creates_TAR_File"| Tar

    click Script "https://github.com/notglop/docker-drag/blob/master/docker_pull.py"

    classDef cli fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef script fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef registry fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef output fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
