geerlingguy/docker-ubuntu1804-ansible

Docker image missing systemctl

zoeyronain opened this issue · 2 comments

I'm trying to test out an ansible role using your docker image on Travis, however it's unable to enable UFW for the next few steps of the role.

TASK [zoeycluff.betterpress : enable UFW] ************************************** fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/bin/systemctl", "msg": "Failed to connect to bus: No such file or directory", "rc": 1, "stderr": "Failed to connect to bus: No such file or directory\n", "stderr_lines": ["Failed to connect to bus: No such file or directory"], "stdout": "", "stdout_lines": []} [WARNING]: Could not create retry file '/etc/ansible/roles/zoeycluff.betterpress/tests/test.retry'. [Errno 30] Read-only file system: u'/etc/ansible/roles/zoeycluff.betterpress/tests/test.retry'

I changed the init in .travisci to "init: /sbin/init" but it's still trying to use systemctl.

Any idea what else to try? or if possible is there a when statement I can add that disables these steps only in a docker container?

the repo is https://github.com/zoeycluff/ansible-role-betterpress

I appreciate any help!

#12

Seems like this is related

@ZoeyCluff it's been a year so not sure if you care anymore. However, for everyone else running ansible inside of a docker container does work better with privileged mode and mounting /sys/fs/cgroup:/sys/fs/cgroup:ro into the container when running.

The alternative is to install a systemctl replacement like https://github.com/gdraheim/docker-systemctl-replacement and you can run docker containers without privileges.