Post

Gentle Container Introduction

Docker whale

This is the fourth post in a series about containers in Infix. This time we go back to basics for a more gentle introduction into using containers.

We will use one real interface, connected to the outside world, and one VETH pair. One end of the pair in the host and the other given to the container. The host end of the pair can be bridged or routed, this is left as an exercise to the reader.

See the first post for a background and networking basics.

This post assumes knowledge and familiarity with the Infix Network Operating System. Ensure you have either a network connection or console access to your Infix system and can log in to it using SSH. Recommended reading includes the networking documentation.


Introduction

Let’s set up the basic building blocks used with most containers, which is usually hidden from users.

  1. You need the Latest Build of Infix. Either on an actual device, or a Linux PC with the x86_64 image for testing with Qemu
  2. In Qemu you need to activate separate /var, at least 256 MiB: ./qemu.sh -c
  3. Start Infix: ./qemu.sh

Configuration

The Infix configuration consists of two parts: networking setup and the container. We start with the networking, we want a single port as our WAN port, connected to the Internet, and a VETH pair where one end will be handed over to the container.

Notice the DHCP client on interface e1, it is required since we need Internet access to download the container image below.

1
2
3
4
5
6
7
8
9
10
admin@infix:/> configure
admin@infix:/config/> set dhcp-client client-if e1
admin@infix:/config/> edit interface veth0a
admin@infix:/config/interface/veth0a/> set veth peer veth0b
admin@infix:/config/interface/veth0a/> set ipv4 address 192.168.0.1 prefix-length 24
admin@infix:/config/interface/veth0a/> end
admin@infix:/config/> edit interface veth0b
admin@infix:/config/interface/veth0b/> set ipv4 address 192.168.0.2 prefix-length 24
admin@infix:/config/interface/veth0b/> set container-network
admin@infix:/config/interface/veth0b/> leave

Time for the container configuration, as usual we employ curiOS containers.

1
2
3
4
5
6
admin@infix:/> configure
admin@infix:/config> edit container system
admin@infix:/config/container/system/> set image docker://ghcr.io/kernelkit/curios:edge
admin@infix:/config/container/system/> set hostname sys101
admin@infix:/config/container/system/> set network interface veth0b
admin@infix:/config/container/system/> leave

We don’t have to leave after each of the above sections, we could just as easily kept going all through the new configuration.

The Result

We should now have a running container.

1
2
3
admin@infix:/> show container 
CONTAINER ID  IMAGE                          COMMAND     CREATED       STATUS        PORTS       NAMES
1cd99db1f518  ghcr.io/kernelkit/curios:edge              16 hours ago  Up 6 seconds              system

We can enter the container using:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
admin@infix:/> container shell system
root@sys101:/# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr D2:A3:70:0D:50:00
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::d0a3:70ff:fe0d:5000/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:63 errors:0 dropped:9 overruns:0 frame:0
          TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12867 (12.5 KiB)  TX bytes:3064 (2.9 KiB)

root@sys101:~$ exit
admin@infix:/> 

Fin

That concludes the fourth post about containers in Infix. As usual, remember to

1
admin@infix:/> copy running-config startup-config

Take care! <3


This post is licensed under CC BY 4.0 by the author.