1

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.

Robin Green
  • 32,079
  • 16
  • 104
  • 187

1 Answers1

1

This command worked:

sudo docker run -it -p 8022:22 --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e container=docker --privileged debug-image /sbin/init
Robin Green
  • 32,079
  • 16
  • 104
  • 187