Skip to content

Commit bf1bfe9

Browse files
committed
Added high-level diagrams
Signed-off-by: ivanmilevtues <[email protected]>
1 parent 526a9db commit bf1bfe9

10 files changed

+1648
-0
lines changed

.codeboarding/Authentication & Configuration.md

Lines changed: 205 additions & 0 deletions
Large diffs are not rendered by default.

.codeboarding/Build System.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
```mermaid
2+
graph LR
3+
Build_System["Build System"]
4+
Build_Context_Preparation["Build Context Preparation"]
5+
Authentication_Management["Authentication Management"]
6+
API_Versioning_and_Decorators["API Versioning and Decorators"]
7+
Stream_Processing["Stream Processing"]
8+
Error_Handling["Error Handling"]
9+
Build_System -- "Orchestrates" --> Build_Context_Preparation
10+
Build_System -- "Utilizes" --> Authentication_Management
11+
Build_System -- "Processes Output Via" --> Stream_Processing
12+
Build_System -- "Raises" --> Error_Handling
13+
Build_System -- "Enforces Compatibility Via" --> API_Versioning_and_Decorators
14+
Build_Context_Preparation -- "Uses" --> Fnmatch_Utilities
15+
```
16+
[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])
17+
18+
## Component Details
19+
20+
This graph illustrates the core components and their interactions within the `docker-py` library's build system. The primary flow revolves around the `Build System` component, which orchestrates the entire image building process. It relies on `Build Context Preparation` to create the necessary build context, `Authentication Management` for handling registry credentials, and `Stream Processing` to interpret the real-time output from the Docker daemon. `API Versioning and Decorators` ensure compatibility with different Docker API versions, while `Error Handling` provides structured error reporting for various build-related issues.
21+
22+
### Build System
23+
Manages the end-to-end process of building Docker images, including orchestrating context preparation, applying authentication, and processing build output streams. It serves as the primary interface for image creation within the `docker-py` library.
24+
25+
26+
**Related Classes/Methods**:
27+
28+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/build.py#L11-L352" target="_blank" rel="noopener noreferrer">`docker-py.docker.api.build.BuildApiMixin` (11:352)</a>
29+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/build.py#L12-L275" target="_blank" rel="noopener noreferrer">`docker-py.docker.api.build.BuildApiMixin:build` (12:275)</a>
30+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/build.py#L321-L352" target="_blank" rel="noopener noreferrer">`docker-py.docker.api.build.BuildApiMixin:_set_auth_headers` (321:352)</a>
31+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/build.py#L355-L382" target="_blank" rel="noopener noreferrer">`docker-py.docker.api.build.process_dockerfile` (355:382)</a>
32+
- <a href="https://github.com/docker/docker-py/blob/master/docker/models/images.py#L220-L315" target="_blank" rel="noopener noreferrer">`docker-py.docker.models.images.ImageCollection:build` (220:315)</a>
33+
34+
35+
### Build Context Preparation
36+
Responsible for preparing the local build context for Docker image creation. This includes archiving the necessary files and directories, applying exclusion rules from `.dockerignore`, and ensuring the context is ready for transmission to the Docker daemon.
37+
38+
39+
**Related Classes/Methods**:
40+
41+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L70-L120" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build:create_archive` (70:120)</a>
42+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L41-L55" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build:exclude_paths` (41:55)</a>
43+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L22-L38" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build:tar` (22:38)</a>
44+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L159-L219" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build.PatternMatcher` (159:219)</a>
45+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L166-L183" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build.PatternMatcher:matches` (166:183)</a>
46+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L58-L67" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build.build_file_list` (58:67)</a>
47+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/build.py#L123-L139" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.build.mkbuildcontext` (123:139)</a>
48+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/fnmatch.py#L26-L44" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.fnmatch:fnmatch` (26:44)</a>
49+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/fnmatch.py#L47-L60" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.fnmatch:fnmatchcase` (47:60)</a>
50+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/fnmatch.py#L63-L115" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.fnmatch:translate` (63:115)</a>
51+
52+
53+
### Authentication Management
54+
Handles the loading, parsing, and resolution of Docker authentication configurations. It provides mechanisms to retrieve credentials from various sources and format them for inclusion in API requests, particularly for pulling base images during a build.
55+
56+
57+
**Related Classes/Methods**:
58+
59+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L348-L349" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth:load_config` (348:349)</a>
60+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L75-L306" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.AuthConfig` (75:306)</a>
61+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L144-L189" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.AuthConfig.load_config` (144:189)</a>
62+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L285-L303" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.AuthConfig.get_all_credentials` (285:303)</a>
63+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L272-L277" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.AuthConfig._get_store_instance` (272:277)</a>
64+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L244-L270" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.AuthConfig._resolve_authconfig_credstore` (244:270)</a>
65+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L315-L316" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.convert_to_hostname` (315:316)</a>
66+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L327-L329" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.encode_header` (327:329)</a>
67+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L309-L312" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.resolve_authconfig` (309:312)</a>
68+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L319-L324" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.decode_auth` (319:324)</a>
69+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L332-L345" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth.parse_auth` (332:345)</a>
70+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L352-L378" target="_blank" rel="noopener noreferrer">`docker-py.docker.auth._load_legacy_config` (352:378)</a>
71+
72+
73+
### API Versioning and Decorators
74+
Provides utilities for comparing Docker API versions and implements decorators to enforce minimum API versions for client methods. This ensures that API calls are compatible with the connected Docker daemon and handles version-specific behaviors.
75+
76+
77+
**Related Classes/Methods**:
78+
79+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L77-L78" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.utils:version_lt` (77:78)</a>
80+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L81-L82" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.utils:version_gte` (81:82)</a>
81+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L49-L74" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.utils:compare_version` (49:74)</a>
82+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/decorators.py#L24-L34" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.decorators:minimum_version` (24:34)</a>
83+
84+
85+
### Stream Processing
86+
Manages the parsing and handling of streaming data, particularly JSON streams, received from the Docker daemon. This component is crucial for processing real-time output during long-running operations like image builds, enabling progress reporting and error detection.
87+
88+
89+
**Related Classes/Methods**:
90+
91+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/json_stream.py#L35-L40" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.json_stream:json_stream` (35:40)</a>
92+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/json_stream.py#L50-L74" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.json_stream:split_buffer` (50:74)</a>
93+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/json_stream.py#L9-L19" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.json_stream.stream_as_text` (9:19)</a>
94+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/json_stream.py#L43-L47" target="_blank" rel="noopener noreferrer">`docker-py.docker.utils.json_stream.line_splitter` (43:47)</a>
95+
96+
97+
### Error Handling
98+
Defines a hierarchy of custom exception classes used throughout the `docker-py` library. These exceptions represent specific error conditions encountered during interactions with the Docker daemon or due to invalid client-side operations, providing structured error reporting.
99+
100+
101+
**Related Classes/Methods**:
102+
103+
- <a href="https://github.com/docker/docker-py/blob/master/docker/errors.py#L100-L101" target="_blank" rel="noopener noreferrer">`docker-py.docker.errors.InvalidVersion` (100:101)</a>
104+
- <a href="https://github.com/docker/docker-py/blob/master/docker/errors.py#L13-L19" target="_blank" rel="noopener noreferrer">`docker-py.docker.errors.DockerException` (13:19)</a>
105+
- <a href="https://github.com/docker/docker-py/blob/master/docker/errors.py#L153-L155" target="_blank" rel="noopener noreferrer">`docker-py.docker.errors.StreamParseError` (153:155)</a>
106+
- <a href="https://github.com/docker/docker-py/blob/master/docker/errors.py#L158-L162" target="_blank" rel="noopener noreferrer">`docker-py.docker.errors.BuildError` (158:162)</a>
107+
108+
109+
110+
111+
### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
```mermaid
2+
graph LR
3+
Daemon_API_Handler["Daemon API Handler"]
4+
Exec_API_Handler["Exec API Handler"]
5+
Core_Docker_Client["Core Docker Client"]
6+
General_Utilities["General Utilities"]
7+
Authentication_Manager["Authentication Manager"]
8+
Stream_Types["Stream Types"]
9+
API_Error_Handling["API Error Handling"]
10+
API_Decorators["API Decorators"]
11+
Container_Object_Model["Container Object Model"]
12+
Execution_Result_Model["Execution Result Model"]
13+
Core_Docker_Client -- "delegates to" --> Daemon_API_Handler
14+
Core_Docker_Client -- "delegates to" --> Exec_API_Handler
15+
Daemon_API_Handler -- "uses" --> General_Utilities
16+
Daemon_API_Handler -- "returns/uses" --> Stream_Types
17+
Daemon_API_Handler -- "uses" --> Authentication_Manager
18+
Exec_API_Handler -- "uses" --> API_Decorators
19+
Exec_API_Handler -- "uses" --> General_Utilities
20+
Exec_API_Handler -- "raises" --> API_Error_Handling
21+
Exec_API_Handler -- "returns/uses" --> Stream_Types
22+
Container_Object_Model -- "returns" --> Execution_Result_Model
23+
Container_Object_Model -- "uses" --> Exec_API_Handler
24+
```
25+
[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%[email protected]?style=flat-square)](mailto:[email protected])
26+
27+
## Component Details
28+
29+
This component overview describes the structure and interactions of the Docker daemon and execution operations subsystem. It details how the core client interacts with dedicated API handlers for daemon-level information and container command execution, leveraging various utility and model components for authentication, data streaming, error handling, and object representation.
30+
31+
### Daemon API Handler
32+
Manages interactions with the Docker daemon for system-level information, real-time events, and user authentication.
33+
34+
35+
**Related Classes/Methods**:
36+
37+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/daemon.py#L7-L181" target="_blank" rel="noopener noreferrer">`docker.api.daemon.DaemonApiMixin` (7:181)</a>
38+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/daemon.py#L83-L95" target="_blank" rel="noopener noreferrer">`docker.api.daemon.DaemonApiMixin:info` (83:95)</a>
39+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/daemon.py#L24-L81" target="_blank" rel="noopener noreferrer">`docker.api.daemon.DaemonApiMixin:events` (24:81)</a>
40+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/daemon.py#L97-L152" target="_blank" rel="noopener noreferrer">`docker.api.daemon.DaemonApiMixin:login` (97:152)</a>
41+
42+
43+
### Exec API Handler
44+
Provides functionalities for creating and starting execution commands within Docker containers.
45+
46+
47+
**Related Classes/Methods**:
48+
49+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py#L5-L176" target="_blank" rel="noopener noreferrer">`docker.api.exec_api.ExecApiMixin` (5:176)</a>
50+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py#L7-L78" target="_blank" rel="noopener noreferrer">`docker.api.exec_api.ExecApiMixin:exec_create` (7:78)</a>
51+
- <a href="https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py#L118-L176" target="_blank" rel="noopener noreferrer">`docker.api.exec_api.ExecApiMixin:exec_start` (118:176)</a>
52+
53+
54+
### Core Docker Client
55+
The primary entry point for users to interact with the Docker API, abstracting underlying API calls and delegating to specific API handlers.
56+
57+
58+
**Related Classes/Methods**:
59+
60+
- <a href="https://github.com/docker/docker-py/blob/master/docker/client.py#L16-L219" target="_blank" rel="noopener noreferrer">`docker.client.DockerClient` (16:219)</a>
61+
- <a href="https://github.com/docker/docker-py/blob/master/docker/client.py#L184-L185" target="_blank" rel="noopener noreferrer">`docker.client.DockerClient:events` (184:185)</a>
62+
- <a href="https://github.com/docker/docker-py/blob/master/docker/client.py#L192-L193" target="_blank" rel="noopener noreferrer">`docker.client.DockerClient:info` (192:193)</a>
63+
- <a href="https://github.com/docker/docker-py/blob/master/docker/client.py#L196-L197" target="_blank" rel="noopener noreferrer">`docker.client.DockerClient:login` (196:197)</a>
64+
65+
66+
### General Utilities
67+
A collection of helper functions for data manipulation, filtering, command parsing, environment formatting, and version comparisons.
68+
69+
70+
**Related Classes/Methods**:
71+
72+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L1-L206" target="_blank" rel="noopener noreferrer">`docker.utils.utils` (1:206)</a>
73+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L405-L408" target="_blank" rel="noopener noreferrer">`docker.utils.utils.datetime_to_timestamp` (405:408)</a>
74+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L391-L402" target="_blank" rel="noopener noreferrer">`docker.utils.utils.convert_filters` (391:402)</a>
75+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L77-L78" target="_blank" rel="noopener noreferrer">`docker.utils.utils.version_lt` (77:78)</a>
76+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L486-L487" target="_blank" rel="noopener noreferrer">`docker.utils.utils.split_command` (486:487)</a>
77+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/utils.py#L490-L498" target="_blank" rel="noopener noreferrer">`docker.utils.utils.format_environment` (490:498)</a>
78+
79+
80+
### Authentication Manager
81+
Handles the loading, resolution, and management of Docker registry authentication configurations.
82+
83+
84+
**Related Classes/Methods**:
85+
86+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L348-L349" target="_blank" rel="noopener noreferrer">`docker.auth.load_config` (348:349)</a>
87+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L75-L306" target="_blank" rel="noopener noreferrer">`docker.auth.AuthConfig` (75:306)</a>
88+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L209-L242" target="_blank" rel="noopener noreferrer">`docker.auth.AuthConfig.resolve_authconfig` (209:242)</a>
89+
- <a href="https://github.com/docker/docker-py/blob/master/docker/auth.py#L305-L306" target="_blank" rel="noopener noreferrer">`docker.auth.AuthConfig.add_auth` (305:306)</a>
90+
91+
92+
### Stream Types
93+
Defines specialized data structures for managing cancellable data streams, typically used for real-time event monitoring.
94+
95+
96+
**Related Classes/Methods**:
97+
98+
- <a href="https://github.com/docker/docker-py/blob/master/docker/types/daemon.py#L8-L71" target="_blank" rel="noopener noreferrer">`docker.types.daemon.CancellableStream` (8:71)</a>
99+
100+
101+
### API Error Handling
102+
Provides specific error classes for handling exceptions related to Docker API version compatibility.
103+
104+
105+
**Related Classes/Methods**:
106+
107+
- <a href="https://github.com/docker/docker-py/blob/master/docker/errors.py#L100-L101" target="_blank" rel="noopener noreferrer">`docker.errors.InvalidVersion` (100:101)</a>
108+
109+
110+
### API Decorators
111+
Contains utility decorators used to apply common checks or transformations to API methods, such as resource validation.
112+
113+
114+
**Related Classes/Methods**:
115+
116+
- <a href="https://github.com/docker/docker-py/blob/master/docker/utils/decorators.py#L7-L21" target="_blank" rel="noopener noreferrer">`docker.utils.decorators.check_resource` (7:21)</a>
117+
118+
119+
### Container Object Model
120+
Represents a Docker container object and offers methods to perform operations directly on a container instance, like executing commands.
121+
122+
123+
**Related Classes/Methods**:
124+
125+
- <a href="https://github.com/docker/docker-py/blob/master/docker/models/containers.py#L20-L529" target="_blank" rel="noopener noreferrer">`docker.models.containers.Container` (20:529)</a>
126+
- <a href="https://github.com/docker/docker-py/blob/master/docker/models/containers.py#L167-L224" target="_blank" rel="noopener noreferrer">`docker.models.containers.Container:exec_run` (167:224)</a>
127+
128+
129+
### Execution Result Model
130+
Encapsulates the outcome of an execution command performed within a Docker container.
131+
132+
133+
**Related Classes/Methods**:
134+
135+
- <a href="https://github.com/docker/docker-py/blob/master/docker/models/containers.py#L5-L8" target="_blank" rel="noopener noreferrer">`docker.models.containers.ExecResult` (5:8)</a>
136+
137+
138+
139+
140+
### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)

0 commit comments

Comments
 (0)