@@ -10,174 +10,139 @@ and the German name Schmidt, the cooper trade is also the origin of German names
10
10
> There is still demand for high-quality ~~ wooden barrels~~ containers, and it is thought that the
11
11
highest-quality ~~ barrels~~ containers are those hand-made by professional ~~ coopers~~ kublers.
12
12
13
- At the core Kubler is just a simple ~~ craftsman~~ bash script that, well, builds things.. and things that
14
- can depend on other things. It does'nt really care all too much about the details as long as it gets
15
- to build. So what, some ~~ people~~ scripts just like to build things. Don't judge.
13
+ ## Why Should You Care?
16
14
17
- What kind of things? In theory your imagination is the limit, but we provide batteries for building
18
- [ Docker] [ ] images, with [ acbuild] [ ] (read: rkt and OCI) support in the works. PR are always welcome. ;)
15
+ Perhaps:
19
16
20
- Due to it's unrivaled flexibility [ Gentoo] [ ] is used under the hood as build container base,
21
- however the final images hold just the runtime dependencies for selected software packages, resulting
22
- in very slim images. To achieve this a 2 phase build process is employed, essentially the often requested, but
23
- still missing, Docker feature for [ nested] ( https://github.com/docker/docker/issues/7115 ) image builds.
17
+ 1 . You love Docker but are annoyed by some of the restrictions of it's ` build ` command that keep
18
+ getting into your way. Wouldn't it be nice if you could ` build ` your images with all ` docker run `
19
+ args, like ` -v ` , at your disposal?
20
+ 2 . You are a SysAdmin or DevOps engineer who seeks complete governance for the contents of their
21
+ Docker images, with full control of the update cycle and the ability to track software version
22
+ changes across the board from a centralized vcs repository.
23
+ 3 . You need to manage a ** lot** of Docker base/service images in a sane way and want peace of mind
24
+ with automated post-build tests.
25
+ 4 . You are a Gentoo user that wants to build slim Gentoo based images without having to wrestle
26
+ with CrossDev.
27
+ 5 . You are looking for an interactive OS host agnostic Gentoo playground or a portable ebuild
28
+ development environment.
29
+ 6 . You want to create custom root file systems, possibly for different cpu architectures, in a safe
30
+ and repeatable manner.
24
31
25
- ## Goals
32
+ ## Cool. So What Exactly Is A Container Image Meta Builder?
26
33
27
- * Central, organization-wide management of base images
28
- * Containers should only contain the bare minimum to run
29
- * Separate build and runtime dependencies
30
- * Only deploy runtime dependencies
31
- * Maximum flexibility while assembling the root file system, but with minimal effort
32
- * Keep things maintainable as the stack grows
34
+ While Kubler was designed primarily for building and managing container images it doesn't
35
+ particularly care about the way those images are built. At the core it's just a glorified directory
36
+ crawler, with a simple dependency mechanism, that fires a command on a selected image or namespace
37
+ dependency graph.
33
38
34
- ## Status
39
+ The actual build logic is abstracted away into pluggable engines that may orchestrate other tools,
40
+ like Docker, to create the final image, or whatever the selected namespace's configured engine
41
+ produces.
35
42
36
- * Stable for a while now and used in production
37
- * Monthly update cycle for all reference images
43
+ Kubler is extendable, users may provide their own commands and/or build engines in a maintainable
44
+ way. As both are just plain old Bash scripts this is usually a simple* and straight forward process
45
+ with almost no limitations.
38
46
39
- ## Features
47
+ ` { font-size: 2px; } ` * Additional rates of blood, sweat and tears may apply when implementing a new engine
40
48
41
- * Decoupled build logic
42
- * Maintain multiple image stacks with differing build engines
43
- * Generic [ root-fs] [ bob-core ] build script to quickly bootstrap a [ Gentoo] [ ] based build container
44
- * Utilizes Gentoo's [ binary package] [ ] features for quick rebuilds
45
- * Simple hook system allows for full control of the build process while retaining modularity
46
- * Generic image and builder dependencies that can be utilized by build engines
47
- * Automated image [ documentation] [ nginx-packages ] and history when using a CVS
49
+ ## Requirements
48
50
49
- ### Docker Features
51
+ #### Kubler
50
52
51
- * Essentially enables [ nested] ( https://github.com/docker/docker/issues/7115 ) docker builds
52
- * Everything happens in docker containers except for some bash glue on the build host
53
- * Glibc, Musl and Uclibc based build containers, each with complete toolchain out of the box
54
- * Tiny static busybox-musl root image (~ 1.2mb), FROM scratch is fine too
55
- * Shared layer support for final images, images are not squashed and can depend on other images
56
- * [ s6] [ ] instead of [ OpenRC] [ ] as default supervisor (small footprint (<1mb) and proper docker SIGTERM handling),
57
- optional of course
58
- * Reference images are available on [ docker hub] [ kubler-docker ]
59
- * Push built image stack(s) to a public or private docker registry
53
+ * Bash version 4.2+, using 4.4+ is highly recommended due to bugs in previous versions.
60
54
61
- ### Requirements
55
+ Optional:
56
+
57
+ * GPG for download verification
58
+
59
+ #### Docker Build Engine
62
60
63
- * Bash 4.x
64
61
* Working Docker setup
62
+ * GIT
63
+ * jq to parse Docker json output
65
64
66
- Optional:
65
+ ## Installation
67
66
68
- * GPG for download verification
67
+ #### On Gentoo
69
68
70
- Kubler has been tested on Gentoo, CoreOS and macOS. It should run on all Linux distributions.
69
+ An ebuild can be found at https://github.com/edannenberg/kubler-overlay/
71
70
72
- ## How much do I save?
71
+ Add the overlay and install as usual:
73
72
74
- * Quite a bit, the Nginx Docker image, for example, clocks in at ~ 17MB, compared to >1GB for a full Gentoo version
75
- or ~ 300MB for a similiar Ubuntu version
73
+ emerge -av kubler
76
74
77
- ## Quick Start
75
+ #### Manual Installation
78
76
79
- $ git clone https://github.com/edannenberg/kubler.git
77
+ Kubler has been tested on Gentoo, CoreOS and macOS. It should run on all Linux distributions.
80
78
81
- Kubler needs a ` working-dir ` to operate from, much like ` git ` needs to be called from inside a git repo for most of its
82
- functionality. You may also call Kubler from any sub directory and it will detect the proper path. The Kubler git repo
83
- comes with an example image stack, let's build a provided ` glibc ` image:
79
+ 1 . Clone the repo or download/extract the release archive to a location of your choice, i.e.
84
80
85
- $ cd kubler /
86
- $ ./ kubler.sh build kubler/glibc
81
+ $ cd ~ /tools /
82
+ $ curl -L https://github.com/edannenberg/ kubler/archive/master.tar.gz | tar xz
87
83
88
- This will build a ` kubler/busybox ` and ` kubler/glibc ` image. You also get a glibc and musl based build container for
89
- free, which you can utilize for your own images.
84
+ 2 . Add ` kubler.sh ` to your path
90
85
91
- * You may add ` kubler.sh ` to your ` PATH ` , one-liner: ` export PATH="${PATH}:/path/to/kubler/bin" `
92
- * If you don't have GPG available use ` build -s .. ` to skip verification of downloaded files (SHA512 is still checked)
93
- * The directories in ` ./dock/kubler/images/ ` contain image specific documentation
86
+ If you are unsure add the following at the end of your ` ~/.bashrc ` file, don't forget to adjust the
87
+ path for each line accordingly:
94
88
95
- Note: If you get a 404 error on downloading a Gentoo stage3 tar ball try running ` kubler update ` to resolve the issue.
96
- The Gentoo servers only keep those files for a few weeks.
89
+ export PATH="${PATH}:/path/to/kubler/bin"
90
+ # optional but highly recommended, adds bash completion support for all kubler commands
91
+ source /path/to/kubler/lib/kubler-completion.bash
97
92
98
- The first run will take quite a bit of time, don't worry, once the build containers and binary package cache
99
- are seeded future runs will be much faster .
93
+ Note: You will need to open a new shell for this to take effect, if this fails on a Linux SystemD
94
+ host re-logging might be required instead .
100
95
101
- ## Creating a new namespace
96
+ #### Uninstall
102
97
103
- Images are kept in a ` namespace ` directory in ` --working-dir ` . You may have any number of namespaces. A helper is
104
- provided to take care of the boiler plate for you:
98
+ 1 . Remove any build artifacts and Docker images created by Kubler:
105
99
106
- ```
107
- $ cd kubler/
108
- $ ./kubler.sh new namespace testing
109
-
110
- --> Who maintains the new namespace?
111
- Name (John Doe): My Name
112
-
113
- --> What type of images would you like to build?
114
- Engine (docker):
100
+ $ kubler clean -N
115
101
116
- --> Successfully added "testing" namespace at ./dock/testing
102
+ 2 . Delete the two entries from ` ~/.bashrc ` you possibly added during manual installation
117
103
118
- $ tree dock/testing/
119
- dock/testing/
120
- |-- .gitignore
121
- |-- kubler.conf
122
- .-- README.md
123
- ```
104
+ 3 . Delete any namespace dirs and configured ` KUBLER_DATA_DIR ` (default is ` ~/.kubler/ ` ) you had in
105
+ use, this may require su permissions.
124
106
125
- You are now ready to work on your shiny new image stack.
107
+ ## Quick Start
126
108
127
- ## Adding Docker images
109
+ #### The Basics
128
110
129
- Let's create a [ Figlet] ( http://www.figlet.org/ ) test image in our new namespace. If you chose a more
130
- sensible namespace name above replace ` testing ` accordingly:
111
+ To get a quick overview/reminder of available commands/options run:
131
112
132
- ```
133
- $ ./kubler.sh new image testing/figlet
113
+ $ kubler --help
134
114
135
- --> Extend an existing image? Fully qualified image id (i.e. kubler/busybox) if yes or scratch
136
- Parent Image (scratch): kubler/glibc
115
+ To view details for specific command:
137
116
138
- --> Successfully added testing/figlet image at ./dock/testing/images/figlet
139
- ```
117
+ $ kubler build -h
140
118
141
- We used ` kubler/glibc ` as parent image, or what you probably know as ` FROM ` in your ` Dockerfiles ` .
142
- The namespace now looks like this:
143
-
144
- ```
145
- $ tree dock/testing/
146
- dock/testing/
147
- |-- kubler.conf
148
- |-- images
149
- | .-- figlet
150
- | |-- build.conf
151
- | |-- build.sh
152
- | |-- Dockerfile.template
153
- | .-- README.md
154
- .-- README.md
155
- ```
119
+ Almost all of Kubler's commands will need to be run from a ` --working-dir ` , if the option is
120
+ omitted the current working dir of the executing shell is used. It functions much like Git in that
121
+ regard, executing any Kubler command from a sub directory of a valid working dir will also work as
122
+ expected.
156
123
157
- Edit the new image's build script located at ` ./dock/testing/images/figlet/build.sh ` and add ` app-misc/figlet ` to the
158
- ` _packages ` variable:
124
+ A ` --working-dir ` is considered valid if it has a ` kubler.conf ` file and either an ` images/ ` dir or
125
+ one ore more namespace dirs, which are just a collection of images.
159
126
160
- ```
161
- _packages="app-misc/figlet"
162
- ```
127
+ #### Setup A New Namespace
163
128
164
- When it's time to build this will instruct the build container in the * first build phase* to install the given package(s)
165
- from Gentoo's package tree at an empty directory. It's content is then exported to the host as a ` rootfs.tar ` file.
166
- In the * second build phase* a normal Docker build is started and the ` rootfs.tar ` file is added to the final image.
129
+ First switch to a directory where you would like to store your Kubler managed images or namespaces:
167
130
168
- See the 'how does it work' section below for more details on the build process. Also make sure to read the comments
169
- in ` build.sh ` . But let's build the darn thing already:
131
+ $ cd ~/workspace
170
132
171
- ```
172
- $ ./kubler.sh build testing
173
- ```
133
+ Then use the ` new ` command to take care of the boiler plate for you, choose ` single ` as namespace
134
+ type when asked:
174
135
175
- Once that finishes we are ready to take the image for a test drive:
136
+ $ kubler new namespace mytest
137
+ $ cd mytest
176
138
177
- ```
178
- $ docker images | grep /figlet
179
- $ docker run -it --rm kubler/figlet figlet kubler sends his regards
180
- ```
139
+ ### Hello Image
140
+
141
+ To create a new image in the current working dir:
142
+
143
+ $ kubler new image mytest/figlet
144
+
145
+ #TODO: finish docs
181
146
182
147
Some useful options for while working on an image:
183
148
@@ -245,6 +210,18 @@ this preserves exact build state
245
210
Build container names generally start with ` */bob ` , when a new build container state is committed the current image
246
211
name gets appended. For example ` kubler/bob-openssl ` refers to the container used to build the ` kubler/openssl ` image.
247
212
213
+ ## Other Resources
214
+
215
+ * An excellent blog post, written by [ @berney ] [ ] , can be found at https://www.elttam.com.au/blog/kubler/
216
+
217
+ ## Discord Community
218
+
219
+ For questions or chatting with other users you may join our Discord server at:
220
+
221
+ https://discord.gg/rH9R7bc
222
+
223
+ You just need a username, email verification with Discord is not required.
224
+
248
225
## Thanks
249
226
250
227
[ @wking ] [ ] for his [ gentoo-docker] [ ] repo which served as an excellent starting point
0 commit comments