Reputation: 1384
I am currently using kitchen-docker
driver for my test kitchen
runs in order to speed up our automated cookbook tests.
However after playing for a while with this I found that every kitchen run fails if there is involved in any recipe a service
resource, if I try to stop/start/restart a service, this is not allowed within the container and the run fails.
If I get inside the container using kitchen login
, every time I try to use systemctl
... I get this error message:
[kitchen@17c054a76e8f ~]$ sudo systemctl restart foo
Failed to get D-Bus connection: Operation not permitted
Is there any way to fix this? I am currently running this image with option privileged: true
in .kitchen.yml
.
Upvotes: 2
Views: 1847
Reputation: 37580
As I didn't make the move to kitchen-dokken yet as well, here is the config that I use to enable systemd inside kitchen-docker:
driver:
name: docker
run_command: /bin/systemd
cap_add:
- SYS_ADMIN
volume:
- /sys/fs/cgroup
WARNING: I assume that you are familiar with the implications of giving a container SYS_ADMIN
capabilities (root-equivalent on the host system, read more).
Upvotes: 4