maci0/docker-systemd-unpriv

systemctl status: Failed to get D-Bus connection: Operation not permitted

Opened this issue · 2 comments

I executed the docker exec command that was printed by run.sh:

docker exec -t -i 5fcd37cf1ae5652ff7f1738e0b8b7579558d4471483aad7ba6d839824e05a039 /bin/bash

Now I'm inside the container. ps shows systemd is running as PID 1:

[root@5fcd37cf1ae5 /]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 40408 2604 ? Ss 13:52 0:00 /usr/lib/systemd/systemd
root 7 0.0 0.0 11780 3056 ? Ss 13:52 0:00 /bin/bash
root 30 0.0 0.0 47432 3428 ? R+ 13:55 0:00 ps aux

But I can't query systemd's status:

[root@5fcd37cf1ae5 /]# systemctl status
Failed to get D-Bus connection: Operation not permitted

I have the same issue when running Docker for Mac (https://docs.docker.com/docker-for-mac/).
On Mac I still need to add --privileged to get dbus running.

I can confirm, that it is working in a "real" (even a qemu) VM running Linux does not need --privileged though.

What could be the reason? Docker for Mac is also running a Linux with the HyperKit (macOS's native virtualization) though

I think this has to to with newer Docker versions which use seccomp. Adding --security-opt seccomp=unconfined makes it work again for me.

This doesn't strike me as a nice solution though.