I have this question which I hope is asked in the right place, if not, feel free to guide me.
I'm developing several Ansible roles and using Molecule as a tool to test the roles against. Molecule uses in turn containers to test the role against.
I'm specifically developing my roles for RHEL 8 based operating systems. I chose to use Rocky Linux as the OS for the container since this is one of the closest OS'es to RHEL.
In a role there are tasks executed using/utilizing systemd. However, containers do not have systemd available by default. There are 'workarounds' to actually make systemd available for containers, which is my goal.
So, I created a container which builds systemd in a Rocky Linux container, following this Dockerfile.
I build the container, and try to start it.
$ docker build -t my_test .
[+] Building 1.4s (6/6) FINISHED
...
Then, I try to run the container, but it provides an error.
$ docker run --tty --privileged --volume /sys/fs/cgroup:/sys/fs/cgroup:ro my_test
Failed to insert module 'autofs4': No such file or directory
systemd 239 (239-51.el8) running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy)
Detected virtualization docker.
Detected architecture x86-64.
Welcome to Rocky Linux 8.5 (Green Obsidian)!
Set hostname to <dea75c1001fd>.
Initializing machine ID from random generator.
Failed to create /init.scope control group: Read-only file system
Failed to allocate manager object: Read-only file system
[!!!!!!] Failed to allocate manager object, freezing.
Freezing execution.
Question: How can I successfully build a container which has systemd available on a Rocky Linux container?
Info: MacOS 10.15.7, Docker version 20.10.11, build dea9396