cs-image-system-docker-runtime-plugin 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cs_image_system_docker_runtime_plugin-0.1.6/.gitignore +28 -0
- cs_image_system_docker_runtime_plugin-0.1.6/LICENSE +202 -0
- cs_image_system_docker_runtime_plugin-0.1.6/PKG-INFO +268 -0
- cs_image_system_docker_runtime_plugin-0.1.6/README.md +250 -0
- cs_image_system_docker_runtime_plugin-0.1.6/pyproject.toml +40 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/__init__.py +3 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/bootstrap.py +129 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/docker_names.py +136 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/docker_packer_source.py +140 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/docker_provider_specific_image.py +40 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/docker_runtime_builders.py +574 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/docker_runtime_models.py +110 -0
- cs_image_system_docker_runtime_plugin-0.1.6/src/cs_image_system/docker_runtime/main.py +27 -0
- cs_image_system_docker_runtime_plugin-0.1.6/tests/test_docker_runtime.py +214 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.envrc
|
|
2
|
+
# Okta API-integration key material -- never commit
|
|
3
|
+
.private_key.pem
|
|
4
|
+
.private_key.json
|
|
5
|
+
.public_key.json
|
|
6
|
+
*.pem
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
.venv/
|
|
14
|
+
.DS_Store
|
|
15
|
+
packages/**/*.code-workspace
|
|
16
|
+
# the IDE rewrites the root workspace file whenever folders are opened: it is the editor's, not the repository's (hygiene XXI)
|
|
17
|
+
/*.code-workspace
|
|
18
|
+
trial
|
|
19
|
+
tfmodules/tftest
|
|
20
|
+
YAML_DUMP.yaml
|
|
21
|
+
.obsidian
|
|
22
|
+
.tofu-plugin-cache/
|
|
23
|
+
_uncommitted/
|
|
24
|
+
target/
|
|
25
|
+
# never publishable, whatever the root (stage 35 refuses them; stage 40's publish-tree checks the policy)
|
|
26
|
+
tfplan
|
|
27
|
+
*.tfstate
|
|
28
|
+
*.tfstate.backup
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: cs-image-system-docker-runtime-plugin
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: The docker runtime type: a durable host's container daemon as a place where images bake and instances run
|
|
5
|
+
Project-URL: Repository, https://github.com/infrastructurebuilder/cs-image-system-3
|
|
6
|
+
Project-URL: Documentation, https://github.com/infrastructurebuilder/cs-image-system-3/blob/develop/docs/OPERATIONS.md
|
|
7
|
+
Project-URL: Package README, https://github.com/infrastructurebuilder/cs-image-system-3/blob/develop/packages/docker-runtime-plugin/README.md
|
|
8
|
+
Author-email: Mykel Alvis <mykelalvis@infrastructurebuilder.org>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Python: >=3.13
|
|
12
|
+
Requires-Dist: cs-image-system-base==0.1.6
|
|
13
|
+
Requires-Dist: cs-image-system-contract==0.1.6
|
|
14
|
+
Requires-Dist: cs-image-system-hashicorp-utils==0.1.6
|
|
15
|
+
Requires-Dist: pydantic>=2.13
|
|
16
|
+
Requires-Dist: python-hcl2>=8.1
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
SPDX-FileCopyrightText: 2026 Mykel Alvis <mykelalvis@infrastructurebuilder.org>
|
|
21
|
+
|
|
22
|
+
SPDX-License-Identifier: Apache-2.0
|
|
23
|
+
-->
|
|
24
|
+
|
|
25
|
+
# cs-image-system-docker-runtime-plugin
|
|
26
|
+
|
|
27
|
+
The `docker` runtime type (stage 103): a durable host running a daemon that
|
|
28
|
+
speaks the Docker Engine API, as a place where images bake and instances
|
|
29
|
+
run. Docker Engine, Docker Desktop, OrbStack, colima and Podman's API
|
|
30
|
+
service all qualify; the system reaches the daemon through the `docker` CLI
|
|
31
|
+
the tree's `cfg/executables.yml` names and the address the runtime declares
|
|
32
|
+
(`host`, a `DOCKER_HOST` URL, or `context`, a docker context), never through
|
|
33
|
+
a cloud API. containerd with nerdctl has no Docker API and is not a target.
|
|
34
|
+
|
|
35
|
+
A container runtime is the third kind of runtime beside the two clouds. It
|
|
36
|
+
differs from them in three ways the design records as decisions:
|
|
37
|
+
|
|
38
|
+
- **No init system.** An image this runtime bakes carries the keepalive
|
|
39
|
+
`sleep infinity` as its command and runs under `--init`; the launch work
|
|
40
|
+
is done by `exec` after the container is created. Services that need
|
|
41
|
+
systemd are not supported on this runtime, and an image test that checks
|
|
42
|
+
an enabled service does not apply here.
|
|
43
|
+
- **Images live in the daemon's store.** A build is its image id
|
|
44
|
+
(`sha256:...`), and its names are tags: `<repository>:<final name>` and
|
|
45
|
+
the series' floating `<repository>:<prefix>`, which a child image bakes
|
|
46
|
+
from when its parent is deferred (the daemon has no "newest image matching
|
|
47
|
+
a pattern" query; the tag is that query). A label is fixed when an image
|
|
48
|
+
is built, so what the core stamps afterwards (the parent bound after the
|
|
49
|
+
bake, the fingerprint, a release) is carried by tags that MOVE:
|
|
50
|
+
`<repository>:<short id>--<key>--<value>`, one per key.
|
|
51
|
+
- **POSIX accounts only.** Access is through the daemon (`docker exec -u`);
|
|
52
|
+
whoever can reach the daemon is root on the host. An OPA group on a docker
|
|
53
|
+
runtime is refused at validation; enrolling `sftd` in a container is a
|
|
54
|
+
later stage.
|
|
55
|
+
|
|
56
|
+
## What it registers
|
|
57
|
+
|
|
58
|
+
| Class | `csis_name()` | `csis_classifier()` | Role |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| `DockerContainerBuilderModel` ([docker_runtime_models.py](src/cs_image_system/docker_runtime/docker_runtime_models.py)) | `docker` | `VCT.CONTAINER_BUILDER_MODEL` (folded into the runtime namespace by the loader) | The runtime's declaration: `host` or `context`, `repository`, `machine_types`, `networking`, `state_configuration`, `executable`. |
|
|
61
|
+
| `DockerContainerBuilder` ([docker_runtime_builders.py](src/cs_image_system/docker_runtime/docker_runtime_builders.py)) | `docker` | `VCT.RUNTIME_BUILDER` | Every runtime hook, answered against the daemon through the CLI. |
|
|
62
|
+
| `DockerCLIVersionChecker` (same file) | `docker` | `VCT.VERSION_CHECKER` | `docker --version` for the `docker` entry of `cfg/executables.yml`. |
|
|
63
|
+
|
|
64
|
+
Entry points: `cs_image_system.plugins.runtime` → `docker`, and (stage 103
|
|
65
|
+
item 15) `cs_image_system.bootstrap` → `docker`, the container-host section of
|
|
66
|
+
the bootstrap interview ([bootstrap.py](src/cs_image_system/docker_runtime/bootstrap.py)):
|
|
67
|
+
|
|
68
|
+
| Class / function | Role |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `docker_section()` → `Section` | The interview's "Container host" section. Wanted where the tree declares a docker runtime. It reads the runtime from the raw `cfg/` (never loading it, never printing an address: a `host` may be an `ENC[age:...]` marker) and asks two questions, which runtime and *can CI reach its daemon* (default yes for an `ssh://` host or for none declared, no for a socket, a context, a `tcp://` host or a marker). |
|
|
71
|
+
|
|
72
|
+
The section has no terraform module, because a daemon is a host somebody runs.
|
|
73
|
+
Its render says what remains by hand (the daemon and its host, the network,
|
|
74
|
+
CI's ssh key and `known_hosts` line, or, when CI cannot reach the daemon, to
|
|
75
|
+
name the runtime in `GUARD_RUNTIME`) and its audit lines are all BY HAND or
|
|
76
|
+
READ. The two secrets it concerns, `DOCKER_HOST_SSH_KEY` and
|
|
77
|
+
`DOCKER_HOST_KNOWN_HOSTS`, are among the GitHub section's, set by its script
|
|
78
|
+
from files.
|
|
79
|
+
|
|
80
|
+
## Models
|
|
81
|
+
|
|
82
|
+
### `DockerContainerBuilderModel`
|
|
83
|
+
|
|
84
|
+
Extends the core's `ContainerBuilderModel` (`host`, `context`, `networking`,
|
|
85
|
+
`machine_types`) and the runtime model every runtime shares
|
|
86
|
+
(`default_machine_type`, `default_image_builder`, `credentials`, `ephemeral`,
|
|
87
|
+
`retention_keep`, ...).
|
|
88
|
+
|
|
89
|
+
| Field | Default | Meaning |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `host` | none | The daemon's address as a `DOCKER_HOST` URL: `unix:///var/run/docker.sock`, `ssh://user@host`, `tcp://host:2376`. May be an `ENC[age:...]` marker when the address itself is private. Declare `host` or `context`, not both. |
|
|
92
|
+
| `context` | none | A docker context name (`docker context ls`), set as `DOCKER_CONTEXT`. |
|
|
93
|
+
| `executable` | `docker` | The `cfg/executables.yml` entry whose `binary` every docker call on this runtime runs through; `validate` version-checks it. |
|
|
94
|
+
| `repository` | `csis/<runtime name>` | Where this runtime's builds are tagged, made a valid repository name (lowercase). |
|
|
95
|
+
| `tls_cert_path`, `tls_verify` | none, false | `DOCKER_CERT_PATH` and `DOCKER_TLS_VERIFY` for a `tcp://` host: TLS material by PATH, never a value. |
|
|
96
|
+
| `networking.network` | `bridge` | The network the bake container (and, later, every instance) joins, by name; referenced, never created or changed. No subnets, no zones. |
|
|
97
|
+
| `machine_types` | `{}` | A map from a name to `{cpus, memory}` (`--cpus 2`, `--memory 4g`). When any are declared, `default_machine_type` must name one. |
|
|
98
|
+
| `state_configuration` | the default state manager | The state manager this runtime's roots use; a tree with no cloud declares `local`. |
|
|
99
|
+
|
|
100
|
+
Nothing in the model is a credential.
|
|
101
|
+
|
|
102
|
+
## The builder
|
|
103
|
+
|
|
104
|
+
### The image query
|
|
105
|
+
|
|
106
|
+
The daemon answers the keys `name` (a repository), `version` (a tag),
|
|
107
|
+
`publisher` (a registry namespace; `library` is Docker Hub's and is
|
|
108
|
+
dropped), `architecture` (a platform, `x86_64` → `linux/amd64`) and
|
|
109
|
+
`native.image` (a reference verbatim). The release catalog's `docker` block
|
|
110
|
+
gives every family one (`almalinux:{version}`, `debian:{version}`, ...). The
|
|
111
|
+
query PULLS the reference and records its digest reference
|
|
112
|
+
(`<repository>@sha256:...`) as the identifier, so a vendor moving a tag shows
|
|
113
|
+
as a move. An entry's `image_id` pins a digest reference; a tag is refused
|
|
114
|
+
there, because a tag moves.
|
|
115
|
+
|
|
116
|
+
### Bakes
|
|
117
|
+
|
|
118
|
+
`packer_source_type()` is `docker`, HashiCorp's docker plugin. The source
|
|
119
|
+
block starts the build container from the parent image (`pull = false`: the
|
|
120
|
+
query pulled every vendor image, and our own builds are local), named
|
|
121
|
+
`csis-bake-<runtime>-<image>` so ansible reaches it by name, under `--init`,
|
|
122
|
+
on the runtime's network, with its machine type's limits, with `/run` a
|
|
123
|
+
tmpfs so the step runner never lands in the image; it `commit`s the result
|
|
124
|
+
with the lineage tags as `LABEL` instructions and `CMD ["sleep",
|
|
125
|
+
"infinity"]`. The runtime adds a `docker-tag` post-processor to the build
|
|
126
|
+
(the final name and the floating tag, in the repository), and the manifest
|
|
127
|
+
records the committed image id as the build id. The ansible provisioner
|
|
128
|
+
connects with `ansible_connection=docker ansible_host=<container name>`,
|
|
129
|
+
passed as `--extra-vars`, the way packer's provisioner documents for its
|
|
130
|
+
docker builder. Bakes run as `root`; the settle step installs `sudo` and
|
|
131
|
+
`python3` when the vendor image lacks them, because every later step is
|
|
132
|
+
written for a cloud image's unprivileged user. No cloud-init wait, no
|
|
133
|
+
session agent.
|
|
134
|
+
|
|
135
|
+
Every tool a bake runs (packer, the docker CLI, ansible's docker connection)
|
|
136
|
+
gets the runtime's `DOCKER_HOST` or `DOCKER_CONTEXT` in its environment
|
|
137
|
+
(`tool_environment()`), so a bake on a remote daemon reaches that daemon.
|
|
138
|
+
|
|
139
|
+
### Names
|
|
140
|
+
|
|
141
|
+
A build's final name is written as a tag: `image_name_as_made` replaces what
|
|
142
|
+
a tag cannot carry with `-`; `image_name_problem` refuses a name longer than
|
|
143
|
+
128 characters once made (the cut would fall where the timestamp is). A
|
|
144
|
+
label key carries no whitespace and no `=`.
|
|
145
|
+
|
|
146
|
+
### Images in the store
|
|
147
|
+
|
|
148
|
+
`query_images` lists every image labelled `csis_series`, its lineage facts
|
|
149
|
+
read from its labels as built with the movable tags' values on top;
|
|
150
|
+
`inventory` adds every container and volume, with the `csis_config` label
|
|
151
|
+
each carries. `dispose_image` removes a build and every tag with it, and is
|
|
152
|
+
REFUSED while a container was created from it. `retag_image` moves the
|
|
153
|
+
per-key tags; `release_commands` moves `<repository>:<series>--<model>`.
|
|
154
|
+
|
|
155
|
+
### Instances
|
|
156
|
+
|
|
157
|
+
The instance hooks (power state, identity, verification, sessions,
|
|
158
|
+
relabel) are the next branch of stage 103; on this branch they answer as the
|
|
159
|
+
core's defaults do ("cannot").
|
|
160
|
+
|
|
161
|
+
## Example configuration
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
runtime_builders:
|
|
165
|
+
- name: docker-local
|
|
166
|
+
type: docker
|
|
167
|
+
context: orbstack # or host: unix:///var/run/docker.sock
|
|
168
|
+
executable: docker
|
|
169
|
+
repository: csis/local
|
|
170
|
+
default_machine_type: small
|
|
171
|
+
default_image_builder: pckr-docker-ans
|
|
172
|
+
machine_types:
|
|
173
|
+
small: { cpus: 1, memory: 1g }
|
|
174
|
+
medium: { cpus: 2, memory: 4g }
|
|
175
|
+
networking:
|
|
176
|
+
network: bridge
|
|
177
|
+
state_configuration: local-state
|
|
178
|
+
|
|
179
|
+
image_builders:
|
|
180
|
+
- name: pckr-docker-ans
|
|
181
|
+
type: packer-docker
|
|
182
|
+
runtime: docker-local
|
|
183
|
+
executable: packer
|
|
184
|
+
required_plugins:
|
|
185
|
+
- name: docker
|
|
186
|
+
source: github.com/hashicorp/docker
|
|
187
|
+
version: '>= 1.0.0'
|
|
188
|
+
- name: ansible
|
|
189
|
+
source: github.com/hashicorp/ansible
|
|
190
|
+
version: '>= 1.0.0'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Prerequisites and integration
|
|
194
|
+
|
|
195
|
+
- A daemon that speaks the Docker Engine API, reachable from the machine
|
|
196
|
+
that runs the system: `docker version` against the runtime's `host` or
|
|
197
|
+
`context` must answer (preflight says so in one line per daemon).
|
|
198
|
+
- The `docker` CLI, declared in `cfg/executables.yml` (`version: ">=24"`
|
|
199
|
+
is the floor the system runs with); `--init` needs the daemon's
|
|
200
|
+
`docker-init`, which every supported daemon ships.
|
|
201
|
+
- `packer` with the `docker` and `ansible` plugins (`required_plugins` of
|
|
202
|
+
the image builder), and `ansible-playbook` on the machine that bakes:
|
|
203
|
+
ansible's docker connection runs the local `docker` CLI against the same
|
|
204
|
+
daemon.
|
|
205
|
+
- Podman's API service works as the daemon (proved 2026-11-01 against Podman
|
|
206
|
+
5.8.2 rootless on AlmaLinux 10, through `docker` over ssh; the setup and what
|
|
207
|
+
differed are in [docs/OPERATIONS.md](../../docs/OPERATIONS.md), "Podman as
|
|
208
|
+
the daemon"). A rootless Podman user needs `/etc/subuid` and `/etc/subgid`
|
|
209
|
+
ranges. Podman Desktop's machine on macOS works too, rootful and beside
|
|
210
|
+
OrbStack (proved 2026-11-01 with Podman 5.8.9; `just
|
|
211
|
+
test-podman-desktop-cycle`, which skips when no machine runs; Podman 6
|
|
212
|
+
dropped Intel Macs, so on one the proof lasts until June 2027).
|
|
213
|
+
- The posix identity plugin for the groups an instance image activates; an
|
|
214
|
+
OPA group is refused on this runtime.
|
|
215
|
+
- A tree whose only runtime is docker declares a `local` state manager; a
|
|
216
|
+
tree with clouds may put the docker roots in its default manager, and
|
|
217
|
+
then needs that cloud's session for them.
|
|
218
|
+
|
|
219
|
+
## Configuration reference
|
|
220
|
+
|
|
221
|
+
See [Models](#models) for every field of the runtime, and the image
|
|
222
|
+
builder's reference in the [packer plugin](../packer-plugin/README.md) for
|
|
223
|
+
`type: packer-docker`. An OS builder's `runtimes[]` entry on a docker
|
|
224
|
+
runtime takes the usual keys; its `query` may use `name`, `version`,
|
|
225
|
+
`publisher`, `architecture` and `native.image`, and its `image_id` is a
|
|
226
|
+
digest reference. `output_image_name` (stage 105) is the tag prefix.
|
|
227
|
+
|
|
228
|
+
## What it tests and verifies
|
|
229
|
+
|
|
230
|
+
- `validate` version-checks the `docker` executable and refuses a query key
|
|
231
|
+
the daemon cannot answer, a label key it cannot carry, a build name longer
|
|
232
|
+
than a tag, a `default_machine_type` that names no declared machine type,
|
|
233
|
+
and a runtime that declares both `host` and `context`.
|
|
234
|
+
- `preflight` runs `docker version` against each docker runtime's daemon
|
|
235
|
+
and prints whether it answers.
|
|
236
|
+
- The unit tests ([tests/](tests/)) pin the names module (tags, repository
|
|
237
|
+
names, movable tags), the query translation, the model's environment and
|
|
238
|
+
the packer source and post-processor shapes without a daemon; the
|
|
239
|
+
system's stage 103 tests drive a dry `run --all` over an overlay of the
|
|
240
|
+
frozen fixture and check the emitted docker sources.
|
|
241
|
+
- `just test-docker-bake`, a leg of `just full-test`, bakes an AlmaLinux 10
|
|
242
|
+
and a Debian 12 base image and an instance image on the local daemon,
|
|
243
|
+
checks the lineage and the tags, disposes them, and skips loudly without
|
|
244
|
+
docker.
|
|
245
|
+
- The bootstrap section is tested without a daemon: its discovery and
|
|
246
|
+
wanting, the reach rule (an `ssh://` host or none declared is reachable;
|
|
247
|
+
a socket, a context, `tcp://` and a marker are not), the quiet interview
|
|
248
|
+
of the `standard-docker` starter, the guard default in a tree with a
|
|
249
|
+
runtime CI cannot reach, and that no address or marker reaches the
|
|
250
|
+
generated README.
|
|
251
|
+
|
|
252
|
+
## When it fails
|
|
253
|
+
|
|
254
|
+
| Symptom | Cause | Remedy |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| `the configuration cannot load: docker runtime X: the daemon at ... cannot be reached` | The daemon is not running, or `host`/`context` names the wrong one. | Start it (OrbStack, Docker Desktop, the engine on the host) or fix the address; `preflight` shows which daemon answers. |
|
|
257
|
+
| `executable 'docker' is not declared in cfg/executables.yml` | The runtime's `executable` names no entry. | Declare `- name: docker` with its `binary`. |
|
|
258
|
+
| `image_id '...' is not a digest reference` | An entry pins a tag. | Pin `<repository>@sha256:<digest>` (`docker image inspect --format '{{index .RepoDigests 0}}'`). |
|
|
259
|
+
| `image ... is in use by container(s) ...` at disposal | A container stands on the build. | Decommission the container first; the image is never pulled from under it. |
|
|
260
|
+
| An ansible step cannot reach the container | The bake ran against a daemon other than the one the local `docker` CLI uses. | The runtime's `host`/`context` is what both read; check `DOCKER_HOST` is not also set in the shell to something else. |
|
|
261
|
+
| The bootstrap says `docker.runtime: ... -- no default can be derived` under `--quiet` | The tree declares no runtime of type `docker`, or the section was kept from an earlier interview of a tree that had one. | Declare the runtime, or answer `want_docker: no`. |
|
|
262
|
+
| `parent: lineage=<id> tag=series:<name>` in the state query on a Podman daemon | A release before 2026-11-01 compared `RepoTags` as written; Podman spells them `docker.io/<repository>:<tag>`. | Take a later release; nothing on the daemon needs repairing, the movable tags were there. |
|
|
263
|
+
| `a docker tag is at most 128 characters` at validate | A declared `output_image_name` is too long once the timestamp is appended. | Shorten it. |
|
|
264
|
+
|
|
265
|
+
## Related
|
|
266
|
+
|
|
267
|
+
- [docs/OPERATIONS.md](../../docs/OPERATIONS.md), [docs/CONFIGURATION.md](../../docs/CONFIGURATION.md)
|
|
268
|
+
- [packer-plugin](../packer-plugin/README.md) (`type: packer-docker`), [posix-identity-plugin](../posix-identity-plugin/README.md)
|