-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: Switch to fedora and mkosi based binaries
Switch to fedora base image with systemd and reuse the binaries generated for mkosi based builds. The docker image is inspired from Kind node image Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
- Loading branch information
Showing
6 changed files
with
110 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Adapted from https://github.com/kubernetes-sigs/kind/blob/main/images/base/Dockerfile | ||
|
||
ARG BASE_IMAGE=registry.fedoraproject.org/fedora:39 | ||
FROM $BASE_IMAGE AS base | ||
|
||
RUN echo "Installing Packages ..." \ | ||
&& dnf install -y \ | ||
systemd \ | ||
conntrack iptables nftables iproute ethtool util-linux kmod \ | ||
libseccomp pigz fuse-overlayfs \ | ||
nfs-utils which systemd-pam \ | ||
bash ca-certificates curl jq procps \ | ||
&& find /lib/systemd/system/sysinit.target.wants/ -name "systemd-tmpfiles-setup.service" -delete \ | ||
&& rm -f /lib/systemd/system/multi-user.target.wants/* \ | ||
&& rm -f /etc/systemd/system/*.wants/* \ | ||
&& rm -f /lib/systemd/system/local-fs.target.wants/* \ | ||
&& rm -f /lib/systemd/system/sockets.target.wants/*udev* \ | ||
&& rm -f /lib/systemd/system/sockets.target.wants/*initctl* \ | ||
&& rm -f /lib/systemd/system/basic.target.wants/* \ | ||
&& echo "ReadKMsg=no" >> /etc/systemd/journald.conf | ||
|
||
RUN echo "Enabling / Disabling services ... " \ | ||
&& systemctl mask systemd-binfmt.service \ | ||
&& systemctl enable systemd-logind dbus.socket | ||
|
||
|
||
# Add podvm resources | ||
COPY ./resources/binaries-tree/etc/ /etc/ | ||
COPY ./resources/binaries-tree/usr/ /usr/ | ||
COPY ./resources/binaries-tree/pause_bundle/ /pause_bundle/ | ||
|
||
RUN curl -LO https://raw.githubusercontent.com/confidential-containers/cloud-api-adaptor/main/src/cloud-api-adaptor/podvm/qcow2/misc-settings.sh | ||
|
||
RUN PODVM_DISTRO=ubuntu CLOUD_PROVIDER=generic DISABLE_CLOUD_CONFIG=true bash ./misc-settings.sh | ||
|
||
COPY --chmod=0755 entrypoint.sh /usr/local/bin/ | ||
|
||
# https://systemd.io/CONTAINER_INTERFACE/ | ||
ENV container=docker | ||
|
||
# systemd exits on SIGRTMIN+3, not SIGTERM (which re-executes it) | ||
# https://bugzilla.redhat.com/show_bug.cgi?id=1201657 | ||
STOPSIGNAL SIGRTMIN+3 | ||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh", "/sbin/init" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Adapted from https://github.com/kubernetes-sigs/kind/blob/main/images/base/files/usr/local/bin/entrypoint | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
|
||
set_machine_id() { | ||
# Deletes the machine-id embedded in the podvm image and generates a new one. | ||
echo "clearing and regenerating /etc/machine-id" | ||
rm -f /etc/machine-id | ||
systemd-machine-id-setup | ||
} | ||
|
||
|
||
set_product_uuid() { | ||
# The system UUID is usually read from DMI via sysfs, Fake it so that | ||
# each podvm(container) have a different uuid | ||
mkdir -p /podvm | ||
[[ ! -f /podvm/product_uuid ]] && cat /proc/sys/kernel/random/uuid > /podvm/product_uuid | ||
if [[ -f /sys/class/dmi/id/product_uuid ]]; then | ||
echo "faking /sys/class/dmi/id/product_uuid to be random" | ||
mount -o ro,bind /podvm/product_uuid /sys/class/dmi/id/product_uuid | ||
fi | ||
if [[ -f /sys/devices/virtual/dmi/id/product_uuid ]]; then | ||
echo "faking /sys/devices/virtual/dmi/id/product_uuid as well" | ||
mount -o ro,bind /podvm/product_uuid /sys/devices/virtual/dmi/id/product_uuid | ||
fi | ||
} | ||
|
||
|
||
set_machine_id | ||
set_product_uuid | ||
|
||
# we want systemd to be PID1, so exec to it | ||
echo "starting init" | ||
exec "$@" |