Experimenting With Ubuntu and Debian Linux Containers
Bastille 0.9.x adds experimental support for Ubuntu and Debian Linux containers
Bastille is an open-source system for automating deployment and management containerized applications on FreeBSD.
- Follow @BastilleBSD on Mastodon
- Join the discussion BastilleBSD on Discord
- Join the discussion BastilleBSD on Telegram
- Subscribe to BastilleBSD on YouTube
- Support BastilleBSD on Patreon
Experimental Linux
The Bastille 0.9.x series adds experimental support for Ubuntu and Debian containers. This Linux support extends to Ubuntu “bionic” and “focal” plus Debian “stretch” and “buster”.
This support is achieved using FreeBSD’s native Linux compatibility layer.
The linux module provides limited Linux ABI (application binary interface) compatibility, making it possible to run many unmodified Linux applications and libraries without the need for virtualization or emulation.
Disclaimer
Please note this support is still considered experimental. Not all binaries are guaranteed to work. Your mileage may vary.
That said, we’re excited to see what you can achieve with this feature!
Bootstrap
Before you can create Ubuntu or Debian containers you will need to bootstrap the release. This follows the same standard format to bootstrap a FreeBSD release.
Ubuntu 18.04 “Bionic Beaver”
Usage:
bastille bootstrap bionic
Example:
ishmael ~ # bastille bootstrap bionic
I: Retrieving InRelease
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://archive.ubuntu.com/ubuntu...
...
This will download and extract ~102M worth of packages using debootstrap
.
Ubuntu 20.04 “Focal Fossa”
Usage:
bastille bootstrap focal
Example:
ishmael ~ # bastille bootstrap focal
I: Retrieving InRelease
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://archive.ubuntu.com/ubuntu...
...
This will download and extract ~109M worth of packages using debootstrap
.
Debian 10 “Buster”
Usage:
bastille bootstrap buster
Example:
ishmael ~ # bastille bootstrap buster
I: Retrieving InRelease
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://deb.debian.org/debian...
...
This will download and extract ~144M worth of packages using debootstrap
.
Debian 9 “Stretch”
Usage:
bastille bootstrap stretch
Example:
ishmael ~ # bastille bootstrap stretch
I: Retrieving InRelease
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://deb.debian.org/debian...
...
This will download and extract ~130M worth of packages using debootstrap
.
Create Ubuntu Container
Creating Ubuntu containers uses the standard create syntax with the addition of
the -L
option, ie; bastille create -L name release ip
.
Ubuntu 18.04
Usage:
bastille create -L name bionic ip
Example:
ishmael ~ # bastille create -L ubuntu-bionic bionic 10.17.89.18
Valid: (10.17.89.18).
Valid: (bastille0).
[ubuntu-bionic]:
ubuntu-bionic: created
Fetching packages...
...
All packages are up to date.
You will see a number of dpkg: warning: ignoring pre-dependency problem!
. This is expected.
This will require ~218M of extracted packages.
Ubuntu 20.04
Usage:
bastille create -L name focal ip
Example:
ishmael ~ # bastille create -L ubuntu-focal focal 10.17.89.20
Valid: (10.17.89.20).
Valid: (bastille0).
[ubuntu-focal]:
ubuntu-focal: created
Fetching packages...
...
All packages are up to date.
You will see a number of dpkg: warning: ignoring pre-dependency problem!
. This is expected.
This will require 237M of extracted packages.
Create Debian Container
Debian 9
Usage:
bastille create -L name stretch ip
Example:
ishmael ~ # bastille create -L debian-stretch stretch 10.17.89.09
Valid: (10.17.89.09).
Valid: (bastille0).
[debian-stretch]:
debian-stretch: created
Fetching packages...
...
All packages are up to date.
You will see a number of dpkg: warning: ignoring pre-dependency problem!
. This is expected.
This will require ~229M of extracted packages.
Debian 10
Usage:
bastille create -L name buster ip
Example:
ishmael ~ # bastille create -L debian-buster buster 10.17.89.10
Valid: (10.17.89.10).
Valid: (bastille0).
[debian-stretch]:
debian-stretch: created
Fetching packages...
...
All packages are up to date.
...
You will see a number of dpkg: warning: ignoring pre-dependency problem!
. This is expected.
This will require ~235M of extracted packages.
Example Login
The bastille console
command works as expected with these Linux containers.
You will be logged in as root and shown the motd.
Example: Bionic
brick ~ # bastille console ubuntu-bionic
[ubuntu-bionic]:
Welcome to Ubuntu 18.04 LTS (GNU/Linux 3.17.0 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Example: Focal
brick ~ # bastille console ubuntu-focal
[ubuntu-focal]:
Welcome to Ubuntu 20.04 LTS (GNU/Linux 3.17.0 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Example: Stretch
ishmael ~ # bastille console debian-stretch
[debian-stretch]:
Linux debian-stretch 3.17.0 FreeBSD 13.0-RELEASE-p3 #0: Tue Jun 29 19:46:20 UTC 2021 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Example: Buster
ishmael ~ # bastille console debian-buster
[debian-buster]:
Linux debian-buster 3.17.0 FreeBSD 13.0-RELEASE-p3 #0: Tue Jun 29 19:46:20 UTC 2021 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Automation
Initial support for automation has also been added by way of the CMD
and
PKG
sub-commands. This means you can automate package installation and
execute arbitrary commands on Linux containers.
Usage:
bastille pkg debian-buster install htop
Example:
[debian-buster]:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
lsof strace
The following NEW packages will be installed:
htop
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 92.8 kB of archives.
After this operation, 230 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 htop amd64 2.2.0-1+b1 [92.8 kB]
Fetched 92.8 kB in 0s (412 kB/s)
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
Selecting previously unselected package htop.
(Reading database ... 9193 files and directories currently installed.)
Preparing to unpack .../htop_2.2.0-1+b1_amd64.deb ...
Unpacking htop (2.2.0-1+b1) ...
Setting up htop (2.2.0-1+b1) ...
Support for the CMD
sub-command works in the same way. Again, your mileage
may vary at this stage.
Usage:
bastille cmd debian-buster cat /etc/debian_version
Example:
ishmael ~ # bastille cmd debian-buster cat /etc/debian_version
[debian-buster]:
10.10
[debian-buster]: 0
Template (default/linux)
With the CMD
and PKG
sub-commands supported we are now able to use
templates to automate Linux containers. This means by default the
default/linux
template is now applied to automate create steps.