-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
84 lines (77 loc) · 2.95 KB
/
Containerfile
File metadata and controls
84 lines (77 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM fedora:41
LABEL description="Fedora 41, Integration Test Target (ITT) with systemd"
LABEL maintainer="foundata GmbH (https://foundata.com)"
# Inform systemd it's running in a container and specify the container manager
# type (this may affect the behavior, see src/basic/virt.c).
# Docker users can overwrite this with "--env container=docker".
ENV container=podman
# Ensure Python output goes directly to the terminal without buffering,
# preventing loss of partial output if an application crashes.
ENV PYTHONUNBUFFERED=1
# Install required packages and clean-up package manager caches afterwards.
# Packages are included for these purposes:
#
# - Overall compatibility and network functionality:
# ca-certificates iproute procps-ng systemd which
#
# - Easier debugging within the container (good feature-to-size ratio):
# iputils less vim-minimal
#
# - Accessing a container via Ansible:
# python3 python3-libdnf5 sudo
RUN dnf -y install \
ca-certificates \
iproute \
procps-ng \
systemd \
which \
iputils \
less \
vim-minimal \
python3 \
python3-libdnf5 \
sudo \
&& dnf clean all
# Configure systemd, mask or remove inconvenient systemd units and services.
# Helpful resources to determine problematic units to be removed:
# systemctl list-dependencies
# systemctl list-units --state=waiting
# systemctl list-units --state=failed
# systemctl mask (if not available: cd path && ln -s -f "/dev/null")
# https://www.freedesktop.org/software/systemd/man/latest/bootup.html
RUN systemctl mask \
# Prevent login prompts, agetty on agetty on tty[1-6] etc.
console-getty.service \
getty.target \
systemd-logind.service \
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service \
systemd-ask-password-wall.service \
# Filesystem related
dev-hugepages.mount \
sys-fs-fuse-connections.mount \
systemd-remount-fs.service \
# Miscellaneous
systemd-initctl.service \
systemd-machine-id-commit.service \
systemd-random-seed.service \
systemd-udevd.service \
systemd-udev-trigger.service \
# Fedora specific
anaconda.service \
anaconda.target \
systemd-oomd.service \
systemd-oomd.socket \
systemd-resolved.service \
&& systemctl disable \
# Fedora specific
dnf-makecache.timer
# Ensure non-interactive sudo commands work in containerized environments where
# TTY allocation is often unavailable or undesired (if needed, it is usually
# allowed on this platform).
RUN sed -i -e 's/\(^Defaults\s*\)\(requiretty\)/\1!\2/' "/etc/sudoers"
# Define volumes for systemd (Podman will do this automatically, but let's add
# this for best-effort Docker compatibility)
VOLUME ["/run", "/run/lock", "/tmp", "/sys/fs/cgroup/systemd", "/var/lib/journal" ]
# Start systemd init
CMD ["/usr/sbin/init"]