I was able to start a docker container running systemd using
sudo docker run -it -p 8022:22 -e container=docker debug-image /sbin/init
However, gdb was not able to debug C processes in this environment, because it lacked the required SYS_PTRACE
capability.
I tried adding --cap-add=SYS_PTRACE
to the docker run
command line, but then systemd
appeared to hang on startup (it printed nothing to the terminal). The same thing happened when I tried passing --privileged
instead.