How to use systemd in a container?

Running systemd in a container is often/usually not recommended. This is a topic that has been discussed a few times in these forums. For a couple of potentially relevant articles, see

here
here

In short, per @dmaze : Systemd does a ton of things, and it's not really appropriate to run inside a Docker container. (It wants to do things like cgroup management that don't make sense; as the blog post you cited suggests, you need to force it to not run every single OS service; and you need to enable the dangerous --privileged option to do it.)