Skip to content

Commit c16016b

Browse files
author
olevole
committed
added buildah notes
1 parent d5683d6 commit c16016b

File tree

3 files changed

+82
-4
lines changed

3 files changed

+82
-4
lines changed

share/docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Exploring the CBSD virtual environment management framework](https://eerielinux.
1515
- [Broker driven CBSD cluster (example)](general/)
1616
- [CBSD integration with PHPIPAM (IP management)](general/wf_ipam.md)
1717
- [API module: private cloud via API](general/cbsd_api.md)
18-
- [About fetch work with CBSD (bases,images,VM), CBSD mirrors](general/cbsd_fetch.md)
18+
- [CBSD and OCI containers](general/cbsd_oci.md)
19+
- [About fetch work: bases,images,VM mirrors](general/cbsd_fetch.md)
1920

2021

2122
<!---

share/docs/general/cbsd_fetch.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# About fetch work with CBSD (bases,images,VM), CBSD mirrors
1+
# About fetch work: bases,images,VM mirrors
22

33
## Description
44

@@ -13,8 +13,8 @@ The CRC amounts are also accompanied by the **CBSD** project participants and ar
1313

1414
As the information on the Internet is in constant dynamic motion, some resources have properties that become obsolete or disappear through the old links, and this happens very often.
1515

16-
The **CBSD** project in most cases tries to protect users from such changes - for this we have launched the official mirror for **CBSD resources**, and we very much welcome any help with resources and maintenance
17-
project on the part of users. You can read about this in the _"Expand Resource Mirror **CBSD**"_ section below.
16+
The **CBSD** project has its own infrastructure (mainly thanks to donors) to protect users from such changes - for this we have launched the official mirror for **CBSD resources**,
17+
and we very much welcome any help with resources and maintenance project on the part of users. You can read about this in the _"Expand Resource Mirror **CBSD**"_ section below.
1818

1919
# fetch.conf
2020

share/docs/general/cbsd_oci.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# CBSD and OCI containers
2+
3+
## Description
4+
5+
The CBSD can use two formats for distributing virtual machine and container images - its own and [OCI containers](https://opencontainers.org/).
6+
There is a misconception that with the advent of OCI all container managers on FreeBSD are deprecated.
7+
8+
There are a few points to note here:
9+
10+
- OCI is an image standard, it does not regulate how exactly to work with the image;
11+
- for 2025y, OCI takes into account and focuses on the capabilities of Linux systems and in particular, the use of groups/FS layers/namespaces. Thus, many things (capabilities, plugins) on FreeBSD marked as: "not supported yet".
12+
As an example - namespaces. For example, in OCI, containers may have 'sysctl' parameters which is widely used - FreeBSD will not allow you to do this:
13+
```
14+
# A list of sysctls to be set in containers by default,
15+
# specified as "name=value",
16+
# for example:"net.ipv4.ping_group_range=0 0".
17+
#
18+
default_sysctls = [
19+
"net.ipv4.ping_group_range=0 0",
20+
]
21+
```
22+
- The official FreeBSD Handbook describes classic jail as `FreeBSD basejail` mounted as RO (nullfs) and overlay data mounted in RW (nullfs).
23+
This is a fundamental difference in the approach to using images, and when someone says "FreeBSD jail managers is obsolete", this approach is meant.
24+
However, it is a relevant approach for freeBSD. Moreover, nothing prevents you from using it in OSI images oriented for FreeBSD - CBSD allows it.
25+
26+
## How to work with OCI
27+
28+
The integration of CBSD and the OCI is achieved using a `buildah` tools.
29+
For this reason, if you plan to use OCI images - you must install package and run CBSD reinitialization:
30+
```
31+
pkg install -y buildah
32+
cbsd initenv
33+
```
34+
35+
If the `buildah` utility is installed, CBSD will start using OCI images automatically in addition to its own images. Check out the current examples in:
36+
```
37+
cbsd images --help
38+
cbsd jstart --help
39+
```
40+
41+
Example1: native FreeBSD image (base-in-pkg-based):
42+
43+
```
44+
cbsd jcreate jname=test ver=empty baserw=1 pkg_bootstrap=0 floatresolv=0 applytpl=0 etcupdate_init=0 from=docker.io/convectix/freebsd14-base runasap=1
45+
cbsd jlogin test
46+
47+
root@test:~ # telnet
48+
Command 'telnet' not found, but can be installed with:
49+
pkg install -y FreeBSD-telnet
50+
```
51+
52+
Example1: Linux image
53+
54+
```
55+
cbsd jcreate jname=test2 ver=empty baserw=1 pkg_bootstrap=0 floatresolv=0 applytpl=0 etcupdate_init=0 exec_start=/bin/true exec_stop=/bin/true from=docker.io/library/alpine emulator=linux runasap=1
56+
cbsd jlogin test
57+
58+
cbsd@test2> uname -a
59+
Linux test2.my.domain 5.15.0 FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c741 GENERIC x86_64 Linux
60+
cbsd@test2> cat /etc/os-release
61+
NAME="Alpine Linux"
62+
ID=alpine
63+
VERSION_ID=3.20.3
64+
PRETTY_NAME="Alpine Linux v3.20"
65+
HOME_URL="https://alpinelinux.org/"
66+
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
67+
```
68+
69+
![cbsd-oci1.png](https://convectix.com/img/cbsd-oci1.png)
70+
71+
## Errata
72+
73+
- Support for `buildah/OCI` is experimental (Also `buildah` package is marked as experimental by itself) - do not use it in production;
74+
- CBSD uses `buildah` tool only to get an image (or generate and push a jail container to the Docker registry);
75+
- At the moment CBSD ignores OCI image `Entrypoints` - work is underway on integration with CBSD daemonize;
76+
- CBSD uses a `buildah` with alternative paths (to store data in the CBSD hier/structure). If you have difficulties with the build, call it with arguments, which you will see in the output
77+

0 commit comments

Comments
 (0)