mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-15 17:28:58 +03:00
Add docker file
This commit is contained in:
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -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"]
|
||||||
18
README.md
18
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)
|
* [Controller manager](./docs/08-controller-manager.md)
|
||||||
* [Kube-proxy](./docs/09-kubeproxy.md)
|
* [Kube-proxy](./docs/09-kubeproxy.md)
|
||||||
* [DNS in Kubernetes](./docs/10-dns.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
|
||||||
Reference in New Issue
Block a user