From 09e3d0e5a1fba67645499cf1d096c1f183c59593 Mon Sep 17 00:00:00 2001 From: Ruslan Savchuk Date: Thu, 27 Mar 2025 10:37:56 +0100 Subject: [PATCH] Add docker file --- Dockerfile | 15 +++++++++++++++ README.md | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7699f33 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:22.04 + +# Update package list and install systemd +# RUN apt-get update && apt-get install -y systemd && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y systemd kmod systemd-sysv && rm -rf /var/lib/apt/lists/* + +# Configure systemd (optional: set default target) +RUN systemctl set-default multi-user.target + +# Remove unnecessary systemd units to speed up boot (optional) +RUN find /etc/systemd/system /lib/systemd/system \ + -path '*.wants/*' -not -name '*systemd*' -exec rm -f {} \; + +# Set systemd as the entrypoint +ENTRYPOINT ["/lib/systemd/systemd", "--system"] \ No newline at end of file diff --git a/README.md b/README.md index 563633e..5a68f5f 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,21 @@ To configure the cluster mentioned, we will use Ubuntu server 20.04 (author uses * [Controller manager](./docs/08-controller-manager.md) * [Kube-proxy](./docs/09-kubeproxy.md) * [DNS in Kubernetes](./docs/10-dns.md) + + + +docker build -t ubuntu-systemd . + + +docker run -d \ + --name ubuntu-systemd-container \ + --privileged \ + --security-opt seccomp=unconfined \ + --security-opt apparmor=unconfined \ + -v /sys/fs/cgroup:/sys/fs/cgroup:rw \ + -v /lib/modules:/lib/modules:ro \ + --tmpfs /tmp \ + --tmpfs /run \ + --tmpfs /run/lock \ + kindest/base:v20250312-b98dc21a \ + /sbin/init \ No newline at end of file