Skip to content

Commit 4776ac7

Browse files
committed
New post, back to docker basics
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent d4d972d commit 4776ac7

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

_posts/2024-10-15-basic-container.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
title: Basic Container Setup
3+
author: troglobit
4+
date: 2024-10-15 07:00:00 +0100
5+
categories: [showcase]
6+
tags: [container, containers, networking, docker, podman]
7+
---
8+
9+
![Docker whale](/assets/img/docker.webp){: width="200" .right}
10+
11+
This is the fourth post in a series about containers in Infix. This
12+
time we go back to basics for a more gentle introduction into using
13+
containers.
14+
15+
See the [first post][1] for a background and networking basics.
16+
17+
> This post assumes knowledge and familiarity with the [Infix Network
18+
> Operating System](https://kernelkit.github.io/). Ensure you have
19+
> either a network connection or console access to your Infix system and
20+
> can log in to it using SSH. Recommended reading includes the
21+
> [networking documentation][0].
22+
{: .prompt-info }
23+
24+
----
25+
26+
27+
## Introduction
28+
29+
Let's set up the basic building blocks used with most containers, which
30+
is usually hidden from users.
31+
32+
![](/assets/img/basic-docker-veth.svg)
33+
34+
1. You need the [*Latest
35+
Build*](https://github.com/kernelkit/infix/releases/tag/latest) of
36+
Infix, use the `x86_64` for [testing with
37+
Qemu](https://github.com/kernelkit/infix/blob/main/doc/virtual.md)
38+
2. In Qemu you need to activate separate `/var`, at least 256 MiB: `./qemu.sh -c`
39+
3. Start Infix: `./qemu.sh`
40+
41+
42+
## Configuration
43+
44+
The Infix configuration consists of two parts: networking setup and the
45+
container. We start with the networking, we want a single port as our
46+
WAN port, connected to the Internet, and a VETH pair where one end will
47+
be handed over to the container.
48+
49+
```console
50+
admin@infix:/> configure
51+
admin@infix:/config/> set dhcp-client client-if e1
52+
admin@infix:/config/> edit interface veth0a
53+
admin@infix:/config/interface/veth0a/> set veth peer veth0b
54+
admin@infix:/config/interface/veth0a/> set ipv4 address 192.168.0.1 prefix-length 24
55+
admin@infix:/config/interface/veth0a/> end
56+
admin@infix:/config/> edit interface veth0a
57+
admin@infix:/config/interface/veth0b/> set ipv4 address 192.168.0.2 prefix-length 24
58+
admin@infix:/config/interface/veth0b/> set container-network
59+
admin@infix:/config/interface/veth0b/> leave
60+
```
61+
62+
Time for the container configuration, as usual we employ [curiOS][2]
63+
containers.
64+
65+
```console
66+
admin@infix:/> configure
67+
admin@infix:/config> edit container system
68+
admin@infix:/config/container/system/> set image docker://ghcr.io/kernelkit/curios:edge
69+
admin@infix:/config/container/system/> set hostname sys101
70+
admin@infix:/config/container/system/> set network interface veth0b
71+
admin@infix:/config/container/system/> leave
72+
```
73+
74+
> We don't have to `leave` after each of the above sections, we could
75+
> just as easily kept going all through the new configuration.
76+
{: .prompt-info }
77+
78+
79+
## The Result
80+
81+
We should now have a running container.
82+
83+
```console
84+
admin@infix:/> show container
85+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
86+
1cd99db1f518 ghcr.io/kernelkit/curios:edge 16 hours ago Up 6 seconds system
87+
```
88+
89+
We can enter the container using:
90+
91+
```console
92+
admin@infix:/> container shell system
93+
root@sys101:/# ifconfig
94+
lo Link encap:Local Loopback
95+
inet addr:127.0.0.1 Mask:255.0.0.0
96+
inet6 addr: ::1/128 Scope:Host
97+
UP LOOPBACK RUNNING MTU:65536 Metric:1
98+
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
99+
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
100+
collisions:0 txqueuelen:1000
101+
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
102+
103+
eth0 Link encap:Ethernet HWaddr D2:A3:70:0D:50:00
104+
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
105+
inet6 addr: fe80::d0a3:70ff:fe0d:5000/64 Scope:Link
106+
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
107+
RX packets:63 errors:0 dropped:9 overruns:0 frame:0
108+
TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
109+
collisions:0 txqueuelen:1000
110+
RX bytes:12867 (12.5 KiB) TX bytes:3064 (2.9 KiB)
111+
112+
root@sys101:~$ exit
113+
admin@infix:/>
114+
```
115+
116+
## Fin
117+
118+
That concludes the fourth post about containers in Infix. As usual,
119+
remember to
120+
121+
```console
122+
admin@infix:/> copy running-config startup-config
123+
```
124+
125+
Take care! <3
126+
127+
----
128+
129+
[0]: https://github.com/kernelkit/infix/blob/main/doc/networking.md
130+
[1]: /posts/containers/
131+
[2]: https://github.com/kernelkit/curiOS/
132+
[3]: https://en.wikipedia.org/wiki/Network_address_translation
133+
[4]: https://github.com/kernelkit/infix/blob/main/doc/cli/text-editor.md
134+
[5]: https://wiki.nftables.org/wiki-nftables/index.php/Main_Page

assets/img/basic-docker-veth.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)