-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
67 lines (63 loc) · 2.67 KB
/
Containerfile
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
# Sample container image with AlmaLinux + Systemd
#
# Description:
#
# This image serves as a basic reference example for user's looking to
# run Systemd inside a system container in order to deploy various
# services within the system container, or use it as a virtual host
# environment.
#
# Usage:
#
# $ docker run --runtime=sysbox-runc -it --rm --name=syscont nestybox/almalinux-8-systemd
#
# This will run systemd and prompt for a user login; the default user/password
# in this image is "admin/admin".
FROM almalinux:8
#
# Systemd installation
#
RUN dnf install -y \
iptables \
iproute \
kmod \
procps-ng \
sudo \
openssh \
openssh-server \
openssh-clients \
httpd \
socat \
udev && \
# enable sshd
systemctl enable sshd httpd && \
# Unmask services
systemctl unmask \
systemd-remount-fs.service \
dev-hugepages.mount \
sys-fs-fuse-connections.mount \
systemd-logind.service \
getty.target \
console-getty.service && \
# Prevents journald from reading kernel messages from /dev/kmsg
echo "ReadKMsg=no" >> /etc/systemd/journald.conf && \
echo "Storage=persistent" >> /etc/systemd/journald.conf && \
\
# Housekeeping
dnf clean all && \
rm -rf \
/var/cache/dnf/* \
# /var/log/* \
/tmp/* \
/var/tmp/* \
/usr/share/doc/* \
/usr/share/man/* && \
\
# Create default 'admin/admin' user
useradd --create-home --shell /bin/bash admin -G wheel && echo "admin:admin" | chpasswd
# Make use of stopsignal (instead of sigterm) to stop systemd containers.
STOPSIGNAL SIGRTMIN+3
# COPY src/systemd /systemd
# Set systemd as entrypoint.
ENTRYPOINT [ "/sbin/init", "--log-level=err" ]
# CMD ["/systemd"]