Linux Container mit Bastille für FreeBSD 13

Linux Container mit Bastille

Attention: For the english version, click here!

In diesem Artikel möchte ich zeigen, wie man Linux Container mit Bastille erstellt. Wer Bastille noch nicht installiert hat, der sollte den Artikel Bastille – Der Jail Manager unter FreeBSD unbedingt lesen, denn darauf bauen wir in dem heutigen Tutorial auf. Die Bastille 0.9.x Reihe bringt zwar Support für Ubuntu und Debian mit, ist allerdings als experimentell einzustufen. Der Jail Manager macht hier Gebrauch vom Linux Compatibility Layer von FreeBSD, den ich in einem früheren Artikel erklärt habe. Der Support von Bastille erstreckt sich über Ubuntu bionic und focal. Für Debian sind es die Releases stretch and buster. Schnell und einfach wie Bastille selbst, ist auch die Erstellung von Linux Containern.

Release bootstrappen

Wie auch bei FreeBSD Containern müssen wir zuerst das entsprechende Release downloaden bzw. bootstrapen. Hier habe ich für jedes unterstützte Release den Befehl aufgeführt:

bastille bootstrap bionic
bastille bootstrap focal
bastille bootstrap stretch
bastille bootstrap buster

Ich habe mich für Ubuntu 20.04 Focal Fossa entschieden. Dabei sollten keine Schwierigkeiten entstehen. Mein Output sieht so aus:

root@byte-sized:/home/mitarbyter # bastille bootstrap focal
fdescfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: fdescfs
fdescfs_load:  -> YES
linprocfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: linprocfs
linprocfs_load:  -> YES
linsysfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: linsysfs
linsysfs_load:  -> YES
tmpfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: tmpfs
tmpfs_load:  -> YES
linux_enable: NO -> YES
Bootstrapping Ubuntu/Linux distfiles...
I: Retrieving InRelease

Linux Container mit Bastille erstellen

Nachdem wir das gewünschte Release geladen haben, können wir nun den dazugehörigen Container erstellen. Das Kommando hierfür baut sich wie folgt auf:

bastille create -L name release ip

Das heißt in meinem Falle von Ubuntu Focal Fossa

bastille create -L ubuntu focal 10.0.0.1

und der Container wird erstellt.

Um in den Container zu wechseln nutzen wir folgendes Kommando:

bastille console name

Also, wer es mir Gleich getan hat und sein Container nur ubuntu genannt hat, tippt folgendes ein:

bastille console ubuntu

Nun ist es uns möglich, ohne vorherigen Wechsel in den Container, Software in dem Container zu installieren:

bastille pkg ubuntu install htop

Das verschafft uns einen riesigen Vorteil, wenn es zur Automatisierung kommt.

Das war’s auch schon. Wie am Anfang schon angekündigt, ist der Linux Container schnell und einfach erstellt und ready-to-go. Have fun!


Creating Linux Containers on FreeBSD using Bastille

In today’s tutorial I’m going to show you, how to create a Linux container using Bastille. If you missed my post on how to install and setup Bastille click here (there is also an english version available). Bastille 0.9.x supports Ubuntu and Debian, but I have to mention that this functionality is experimental. Bastille uses the Linux Compatibility Layer, I’ve explained in a previous post. The following releases are supported:

  • Ubuntu bionic and focal
  • Debian buster and stretch

But now, let’s start! You will see, creating a Linux Container using Bastille will be fast and easy…

Bootstrap your release

Like creating FreeBSD Containers using Bastille, we have to download the release we want to use:

bastille bootstrap bionic 
bastille bootstrap focal 
bastille bootstrap stretch 
bastille bootstrap buster

I have chosen Ubuntu bionic. There should be no difficulties:

root@byte-sized:/home/mitarbyter # bastille bootstrap focal
fdescfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: fdescfs
fdescfs_load:  -> YES
linprocfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: linprocfs
linprocfs_load:  -> YES
linsysfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: linsysfs
linsysfs_load:  -> YES
tmpfs not enabled in /boot/loader.conf, Should I do that for you?  (N|y)
y
Persisting module: tmpfs
tmpfs_load:  -> YES
linux_enable: NO -> YES
Bootstrapping Ubuntu/Linux distfiles...
I: Retrieving InRelease

After downloading the specific release, we are now able to create our Linux Container

Creating the Linux Container

The generic command for creating a container looks like that:

bastille create -L name release ip

So, that means for me:

bastille create -L ubuntu focal 10.0.0.1

The container will be created and after that you are able to switch to your Linux container using the following command:

bastille console ubuntu

Now we are also able to install software into the container without jumping into it by using this command for example:

bastille pkg ubuntu install htop

This is a big advantage when it comes to automation.

That’s it! Like I said in the introduction, it will be fast and easy and so it was. Hope you enjoyed it!

Start the discussion

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert